The Senate moved the US economy back from the edge of a "fiscal cliff" on Tuesday, voting to avoid imminent tax hikes and spending cuts in a bipartisan deal that could still face stiff challenges in the House of Representatives.
In a rare New Year's session at around 2 am EST (0700 GMT), senators voted 89-8 to raise some taxes on the wealthy while making permanent low tax rates on the middle class that have been in place for a decade.
But the measure did little to rein in huge annual budget deficits that have helped push the U.S. debt to $16.4 trillion.
The agreement came too late for Congress to meet its own deadline of New Year's Eve for passing laws to halt $600 billion in tax hikes and spending cuts which strictly speaking came into force on Tuesday.
But with the New Year's Day holiday, there was no real world impact and Congress still had time to draw up legislation, approve it and backdate it to avoid the harsh fiscal measures.
That will need the backing of the House where many of the Republicans who control the chamber complain that President Barack Obama has shown little interest in cutting government spending and is too concerned with raising taxes.
All eyes are now on the House which is to hold a session on Tuesday starting at noon (1700 GMT).
Obama called for the House to act quickly and follow the Senate's lead.
"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," he said in a statement.
"There's more work to do to reduce our deficits, and I'm willing to do it. But tonight's agreement ensures that, going forward, we will continue to reduce the deficit through a combination of new spending cuts and new revenues from the wealthiest Americans," Obama said.
Members were thankful that financial markets were closed, giving them a second chance to return to try to head off the fiscal cliff.
But if lawmakers cannot pass legislation in the coming days, markets are likely to turn sour. The U.S. economy, still recovering from the 2008/2009 downturn, could stall again if Congress fails to fix the budget mess.
"If we do nothing, the threat of a recession is very real. Passing this agreement does not mean negotiations halt, far from it. We can all agree there is more work to be done," Majority Leader Harry Reid, a Democrat, told the Senate floor.
A new, informal deadline for Congress to legislate is now Wednesday when the current body expires and it is replaced by a new Congress chosen at last November's election.
The Senate bill, worked out after long negotiations on New Year's Eve between Vice President Joe Biden and Senate Republican Minority Leader Mitch McConnell, also postpones for two months a $109 billion "sequester" of sweeping spending cuts on military and domestic programs.
It extends unemployment insurance to 2 million people for a year and makes permanent the alternative minimum tax "patch" that was set to expire, protecting middle-income Americans from being taxed as if they were rich.
The tax hikes do not sit easy with Republicans but conservative senators held their noses and voted to raise rates for the rich because not to do so would have meant increases for almost all working Americans.
"It took an imperfect solution to prevent our constituents from a very real financial pain, but in my view, it was worth the effort," McConnell said.
House Speaker John Boehner - the top Republican in Congress - said the House would consider the Senate deal. But he left open the possibility of the House amending the Senate bill, which would spark another round of legislating.
"The House will honor its commitment to consider the Senate agreement if it is passed. Decisions about whether the House will seek to accept or promptly amend the measure will not be made until House members ... have been able to review the legislation," Boehner and other House Republican leaders said in a statement.
Boehner has struggled for two years to get control over a group of several dozen Tea Party fiscal conservatives in his caucus who strongly oppose tax increases and demand that he force Obama to make savings in the Medicare and Social Security healthcare and retirement programs.
A campaign-style event held by Obama in the White House as negotiations with Senate leaders were taking place on Monday may have made it more difficult for Republicans to back the deal. In remarks to a group of supporters that resembled a victory lap, the president noted that his rivals were coming around to his way of seeing things.
"Keep in mind that just last month Republicans in Congress said they would never agree to raise tax rates on the wealthiest Americans. Obviously, the agreement that's currently being discussed would raise those rates and raise them permanently," he said to applause before the Senate deal was sealed.
Obama's words and tone annoyed Republican lawmakers who seemed to feel that the Democrat was gloating.
"That's not the way presidents should lead," said Republican Senator John McCain, Obama's rival in the 2008 election.
A deal with the House on Tuesday, while uncertain, would not mark the end of congressional budget fights. The "sequester" spending cuts will come up again in February as will the contentious "debt ceiling," which caps how much debt the federal government can hold.
Republicans may see those two issues as their best chance to try to rein in government spending and clip Obama's wings at the start of his second term.