The White House and top Republicans struck a dramatic deal to avert huge New Year tax hikes and postpone automatic spending cuts that had threatened to send the US economy into recession.
After months of agonizing over the crisis, weeks of debate about a possible solution, and days of intense, closed-door negotiations, members of the US Senate voted overwhelmingly 89-8 early Tuesday to pass a controversial bill that averts the so-called "fiscal cliff."
It now goes to the House of Representatives, which could hold a vote on the measure later New Year's Day. US President Barack Obama in a statement urged the House to "pass it without delay."
If the measure is agreed by both chambers of Congress, it would hand Obama a victory by hiking tax rates on households earning over $450,000 a year, but exempt everyone else from a planned tax increase.
"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," Obama said in his statement.
The deal puts off $109 billion in budget cuts across the government for two months, but in the process sets the stage for a new showdown between Obama's Democrats and Republicans in dysfunctional Washington at the end of February.
"There's more work to do to reduce our deficits, and I'm willing to do it," Obama said.
Vice President Joe Biden, who negotiated the deal with top Senate Republican Mitch McConnell, trooped to Capitol Hill to sell it to Democratic senators, some of whom wanted tax hikes to kick in at a lower threshold.
Had no deal been struck, experts warned that the fragile US economy could have been sent spinning back into recession by the $500 billion combined whack from spending cuts and tax hikes.
In the end, the deal was clinched a few hours before a midnight deadline. The Senate vote came just after 2:00 am (0700 GMT), while the House was not due back into session until Tuesday.
Now it remains for Republican House Speaker John Boehner to rally his restive conservative coalition around the pact, which will likely need some Democratic votes in the House to pass.
For two decades, Republicans have fought any attempt to raise taxes so White House officials will see vindication in a deal that enshrines one of Obama's top pledges in his re-election campaign.
In a terse statement, Boehner said his chamber would pick up the legislation if it passed the Senate.
"Decisions about whether the House will seek to accept or promptly amend the measure will not be made until House members -- and the American people -- have been able to review the legislation," he said.
Democrats suggested that the deal, like many congressional bargains, was not perfect, but that it was preferable to the alternative.
"It's not that this proposal is regarded as great or is loved in any way. But it's a lot better than going over the cliff," Senator Chuck Schumer told reporters.
World stock markets, expected to be thrown into turmoil by a failure to beat the deadline, are closed New Year's Day, so lawmakers have a few extra hours of breathing room to get the deal concluded.
The deal means a return to Bill Clinton-era tax rates for top earners to 39.6 percent, starting for couples who make $450,000 a year and above.
Obama had originally campaigned for tax hikes to kick in on household income about $250,000.
The president said earlier that the deal would extend tax credits for clean energy firms and also unemployment insurance for two million people that had been due to expire.
It also includes an end to a temporary two percent cut to payroll taxes for Social Security retirement savings and changes to inheritance and investment taxes.
A source familiar with the deal said that the delay to spending cuts -- known as the sequester -- was financed by increased revenues and spending cuts from defense and non-defense spending.
Earlier, on a day of drama and brinkmanship, Obama had angered Republicans when he warned that he was not done with seeking higher taxes on the rich to pay down the US budget deficit.
"I know the president has fun heckling Congress. It's unfortunate he doesn't spend as much time solving problems as he does with campaigns and pep rallies," said Republican Senator Bob Corker, fuming over the remarks.
Signs that a deal could be close cheered investors as US markets rose before closing for the year. The Dow Jones Industrial Average closed up 1.28 percent at 13,104.14.
Relief seemed to course through the Senate during and after the vote, but both sides were already gearing up for the next legislative showdown, over the need to lift the government's statutory borrowing limit of $16.4 trillion, reached Monday.
The Treasury will take extraordinary measures to keep the government afloat for an undisclosed period of time until the ceiling is raised. Republicans are already demanding spending cuts in return.
That fight will now be doubled, with the deadline for the two-month sequester postponement set up by the fiscal cliff agreement.