WASHINGTON -- The Senate passed the $1.1 trillion government funding bill Saturday night that will keep Uncle Sam in business through next September, while handing lucrative Christmas presents to Wall Street and political parties.

The bill, which funds most of the government for the rest of the fiscal year, had been tied up in procedural disagreements. But all senators eventually relented, paving the way for passage of the bill on a 56 to 40 vote.

The Senate entered a rare weekend session after Sens. Ted Cruz (R-Texas) and Mike Lee (R-Utah) refused to consent to an agreement Friday that would have given their colleagues the weekend off.

Forced to be in session, Senate Majority Leader Harry Reid (D-Nev.) used the opportunity to push ahead with a slew of President Barack Obama’s nominations, which Reid wants to pass before the Senate ends the session for the year.

Lee and Cruz blocked Reid’s plan Friday night, angering members of both parties who didn’t understand what the pair hoped to gain. Evidently, the two conservative allies were talked into letting votes proceed on the so-called "cromnibus" spending bill, rather than stalling until Monday morning.

But Cruz insisted on raising a point of order against the bill's constitutionality, thereby forcing the Senate to hold an extra vote before moving onto to final passage. He was targeting the funding for the Department of Homeland Security, which is carrying out Obama's recent orders on immigration to spare up to 5 million undocumented immigrants from deportation.

"If you believe President Obama's amnesty is unconstitutional, vote yes," Cruz said in an appeal to his colleagues. "If you believe Obama's amnesty is consistent with the Constitution, then vote no."

Had a majority of senators agreed with the conservative firebrand, the bill would have been sent back to the House and set up another showdown over longterm funding to the government. The Senate voted overwhelmingly, however, to table the motion, 22 to 74. A large number of Republicans, including Sens. Dan Coats (Ind.), Mike Enzi (Wyo.), Ron Johnson (Wis.), Pat Toomey (Pa.), and Roger Wicker (Miss.), sided against Cruz.

Following the vote, Democrats crowed that Cruz's procedural objections unwittingly set up the confirmation of 24 Obama nominees, some of whom might have otherwise stalled in the final days of the session. Sen. Lindsey Graham (R-S.C.), who publicly opposed Cruz's strategy, agreed.

"I haven't seen Harry Reid smile like this in years, I don't like it one bit," he tweeted.

"Sen. Cruz's stunt got two fewer votes than the 24 Obama nominees he helped Senate Democrats advance tonight," said Reid spokesman Adam Jentleson.

Cruz and Lee insisted on the vote because they argued that it would put senators on record either backing or opposing Obama’s efforts.

The spending bill provides funding through the end of the fiscal year for all government operations except the Department of Homeland Security, which only gets money to last through February. Republicans insisted on that shorter time frame because they intend to use the deadline to try to defund Obama’s immigration action. But Cruz suggested Friday night that House Speaker John Boehner (R-Ohio) and Senate Minority Leader Mitch McConnell (R-Ky.) might not actually follow through.

One controversial provision in the spending bill weakens the Dodd-Frank Act's restrictions on banks that want to trade in the same sorts of risky derivatives that sparked the financial meltdown of 2008, and allows the banks to back their bets with taxpayer-backed insurance. The bill also dramatically increases the amounts that wealthy donors can give to the major political parties. Some Democrats have said that the two measures together amount to letting wealthy Wall Street employees earn more money, which they can then use to reward lawmakers who backed the spending deal.

A number of prominent liberals voted against the bill because of those provisions, including Sens. Elizabeth Warren (D-Mass.), Tom Harkin (D-Iowa), Sheldon Whitehouse (D-R.I.) and Jeff Merkley (D-Ore.). In all, 21 Democrats and Bernie Sanders (I-Vt.) voted against the measure, as did 18 Republicans.

Obama is expected to sign the bill quickly. Under a stopgap measure Congress passed earlier, the government is funded until Wednesday.

This story was updated to reflect final passage.