Senate passage set the stage for a final showdown in the House, where a vote was expected later Tuesday or perhaps Wednesday on the measure, which also raises tax rates on wealthy Americans.
Even by the recent dysfunctional standards of government-by-gridlock, the activity at both ends of historic Pennsylvania Avenue was remarkable as the administration and lawmakers spent the final hours of 2012 haggling over long-festering differences.
"It shouldn't have taken this long to come to an agreement, and this shouldn't be the model for how we do things around here," said Senate Republican leader Mitch McConnell, who negotiated the agreement with Vice President Joe Biden.
Shortly after the Senate vote, President Barack Obama said, "While neither Democrats nor Republicans got everything they wanted, this agreement is the right thing to do for our country and the House should pass it without delay."
Under the deal, taxes would remain steady for the middle class and rise at incomes over $400,000 for individuals and $450,000 for couples — levels higher than Obama had campaigned for in his successful drive for a second term in office.
Spending cuts totaling $24 billion over two months aimed at the Pentagon and domestic programs would be deferred. That would allow the White House and lawmakers time to regroup before plunging very quickly into a new round of budget brinkmanship certain to revolve around Republican calls to rein in the cost of Medicare and other government benefit programs.
Officials also decided at the last minute to use the measure to prevent a $900 pay raise for lawmakers due to take effect this spring.