The US Congress sent President Barack Obama legislation to stop a recession-threatening "fiscal cliff" of tax increases and spending cuts late on Tuesday night, hours before financial markets reopen after the New Year's holiday.
The bill's passage on a 257-167 vote in the House of Representatives sealed a hard-won political triumph for the president less than two months after he secured re-election while calling for higher taxes on the wealthy.
Moments later, Mr Obama strode into the White House briefing room and said: "Thanks to the votes of Republicans and Democrats in Congress I will sign a law that raises taxes on the wealthiest 2pc of Americans while preventing tax hikes that could have sent the economy back into recession."
The US deficit was still too high, he said: While open to compromise on budgetary issues, he would not offer Congress spending cuts in return for lifting the government's borrowing limit, known as the debt ceiling.
"There is a path forward, if we focus not on politics, but on what's right for the country," said Mr Obama.
He spoke with Vice President Joe Biden at his side, a recognition of the former senator's role as the lead Democratic negotiator in final compromise talks with Senate Republican Leader Mitch McConnell of Kentucky.
The economic as well as political stakes were considerable. Economists have warned that without action by Congress, the tax increases and spending cuts that technically took effect with the turn of the new year at midnight could cause unemployment to spike and send the economy into recession.
Stock markets, which had been unsettled by worries that the deal would fall through, rose in relief.
London's FTSE 100 (FTSE: ^FTSE - news) index of top companies opened up 1.3pc at 5,973.07 points, Frankfurt's DAX 30 (Xetra: ^GDAXI - news) index rose 1.5pc and in Paris the CAC 40 (Paris: ^FCHI - news) rallied 1.7pc. Asian markets gained with Hong Kong jumping 2pc to an 18-month high.
The extraordinary late-night House vote took place less than 24 hours after the Senate passed the measure in the predawn hours on New Year's Day. The legislation cleared the Senate hours after Biden and McConnell, veteran negotiators, sealed a deal.
In addition to neutralising middle class tax increases and spending cuts that technically took effect at midnight on Monday, the legislation raises tax rates on incomes over $400,000 for individuals and $450,000 for couples.
Remarkably, in a party that swore off tax increases two decades ago, dozens of Republicans supported the bill in both houses of Congress.
The Senate approved the measure on a vote of 89-8 less than 24 hours earlier, and in the interim, rebellious House conservatives demanded a vote to add significant spending cuts to the measure. But in the end they retreated.
The measure split the upper ranks of the Republican leadership in the House.
Speaker John Boehner of Ohio voted in favour, while Majority Leader Eric Cantor of Virginia and California Rep. Kevin McCarthy, the party's whip, opposed the bill.
Supporters of the bill in both parties expressed regret that the bill was narrowly drawn, and fell far short of a sweeping plan that combined tax changes and spending cuts to reduce federal deficits. That proved to be a step too far in the two months since Obama called congressional leaders to the White House for a post-election stab at compromise.
Majority Republicans did their best to minimise the bill's tax increases, just as they abandoned their demand from earlier in the day to add spending cuts to the package.
"By making Republican tax cuts permanent, we are one step closer to comprehensive tax reform that will help strengthen our economy and create more and higher paychecks for American workers," said Rep. Dave Camp of Michigan, chairman of the tax-writing House Ways and Means Committee.
He urged a vote for passage to "get us one step closer to tax reform in 2013" as well as attempts to control spending.
House Democratic Leader Nancy Pelosi also said the legislation included "permanent tax relief for the middle class," and she summoned lawmakers to provide bipartisan support as the Senate did.
The bill would prevent an expiration of extended unemployment benefits for an estimated two million jobless, renew tax breaks for businesses and renewable energy purposes, block a 27pc cut in fees for doctors who treat elderly Medicare patients, stop a $900 pay increase for lawmakers from taking effect in March and head off a threatened spike in milk prices.
The bill would also raise the top tax rate on large estates to 40pc, from 35pc, and taxes on capital gains and dividends over $400,000 for individuals and $450,000 for couples would be taxed at 20pc, up from 15pc.
It would stop $24bn in spending cuts set to take effect over the next two months, although only about half of that total would be offset with spending reductions elsewhere in the budget.
Even with enactment of the legislation, taxes are on the rise for millions.
The higher taxes on the wealthy - which will deliver some $600bn in revenue over 10 years - are likely slow the economy a little bit.
But a bigger drag on the economy will come from a tax hike Democrats and Republicans didn't even bothering to fight over: the end of a 2 percentage point temporary cut in the Social Security payroll tax, originally enacted two years ago to stimulate the economy, expired with the end of 2012.
The so-called payroll tax is scheduled to bounce back up to 6.2pc this year from 4.2pc in 2011 and 2012, amounting to a $1,000 tax increase for someone earning $50,000 a year.
"It's a huge hit," says Joel Naroff, president of Naroff Economic Advisors. "It hits people whether they're making $10,000 or they're making $2 million. It doesn't matter who you are ... The lower your income, the more of your income you're (spending). So if you're taxes go up, it's going to come out of your spending."
That is bad news for an economy that is 70pc consumer spending.
House Republicans spent much of the day struggling to escape a political corner they found themselves in. "I personally hate it," said Republican John Campbell of California, said of the measure, giving voice to the concern of many Republicans that it did little or nothing to cut spending.
Within hours, Republicans abandoned demands to add spending cuts to the bill and agreed to a simple yes-or-no vote on the Senate-passed bill. They feared that otherwise the Senate would refuse to consider any alterations, sending the bill into limbo and saddling Republicans with the blame for a whopping middle class tax increase.
If the House failed to pass the Senate bill it would mean that any fiscal deal would have to start all over when a new Congress, with dozens of new members, is seated Thursday. And any change in the legislation would require the Senate to repass the measure before it could go to Mr Obama for his signature.
The non-partisan Congressional Budget Office said the deal would add nearly $4 trillion over a decade to federal deficits, a calculation that assumed taxes would otherwise have risen on taxpayers at all income levels.
If Mr Obama and Congress failed to act, about $536bn in tax increases, touching nearly all American workers, and about $110bn in spending cuts, about 8pc of the annual budgets for most federal departments, were scheduled to start going into effect beginning in January.