A $1.1 trillion spending bill is on its way to US president Barack Obama for his signature.

The Senate voted 56-40 yesterday for the long-term funding bill, the main item left on Congress' year-end agenda.

The measure provides money for nearly the entire US government through the September 30 end of the current budget year.

The sole exception is the Department of Homeland Security, which is funded only until February 27.

At that point, Republicans intend to try to force Mr Obama to roll back a new policy that removes the threat of deportation from millions of immigrants living in the country illegally.

The compromise bill had faced opposition from Democratic liberals upset about the repeal of a banking regulation and Republican conservatives unhappy that it failed to challenge the president's immigration moves.

The fight over the spending bill reflects the Republicans' new leverage after their sweeping victories in last month's midterm elections.

They will have control of the Senate and a stronger majority in the House of Representatives when the new Congress convenes in January.

Immigration was the issue that Senator Ted Cruz, a favorite of the ultraconservative tea party movement, cited late Friday when he tried to challenge the spending bill with a proposal to cut funds that could be used to implement Mr Obama's executive actions on immigration.

That led to the unravelling of an informal bipartisan agreement to give the Senate the weekend off. It also gave Democratic Senate majority leader Harry Reid a chance to call an all-day Senate session yesterday devoted almost exclusively to the work of confirming about 20 of Mr Obama's nominees to judicial and administration posts.

Several Republicans blamed Mr Cruz, a potential presidential candidate in 2016, for creating an opening for the outgoing majority party to exploit.

The Senate Republican leader, Mitch McConnell, made no public comment on the events, even though Mr Cruz suggested on Friday night that Mr McConnell and House speaker John Boehner should not be entirely trusted to keep their pledge to challenge the president's immigration policy in January.

Many Democrats, including Mr Obama, recognised that if the current spending bill failed, Republicans would have passed an even more objectionable one when they take full control of Congress next month.

Mr Obama called the bill a classic compromise produced by "the divided government that the American people voted for".

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.