Q&A: The US fiscal cliff
A deal on the so-called "fiscal cliff" has been reached.
A 31 December deadline focused the minds of politicians, but it came down to the wire.
The US only managed to pass legislation to impose higher taxes on the wealthiest Americans and postpone the start of big spending cuts on 1 January.
Failure to reach a deal would probably have sent the US economy back into recession.
What was the fiscal cliff?
The roots of the current crisis date back to 2001, when President George W Bush managed to pass a programme of tax cuts worth $1.7bn. The measures were pushed through under a provision that the tax cuts would expire at the start of 2011.
In 2010, a deal was struck with the Republican-controlled Congress to extend the deadline for two years. Republicans also agreed to a payroll tax cut for citizens.
Separately, in 2011, President Barack Obama's administration tried to raise the US government's borrowing limit - the "debt ceiling", which is set by statute - as part of a budget deal to tackle the ballooning US deficit.
But disagreements with Republicans over the government's borrowing levels led to a compromise that meant the debt ceiling was extended to 31 December 2012 - the same day as when the Bush tax cuts expired.
Other tax changes and temporary spending measures were added to the legislation, which President Obama hoped would bolster an economy that was sinking into recession and losing jobs at a rapid rate.
Therefore, automatic tax increases of about $536bn and spending cuts of $109bn from domestic and military programme would be triggered if no broader deal on the budget was reached on 31 December.
So for another two years, politicians had failed to agree a deal on what would happen - and the small matter of the US presidential election got in the way for much of past two years.
Republicans control the House of Representatives in Congress and enjoy a blocking minority in the Democrat-controlled Senate, while President Obama, a Democrat, wields a veto, so any deal had to be backed by both political parties.
How did we get to the deal?
Over the last month, there have been a few attempts to reach a deal. President Obama had previously insisted that taxes must rise on all those earning in excess of $250,000, but then offered to raise that threshold to $400,000.
The Republican Speaker of the House of Representatives, John Boehner, had offered to allow the tax cut to expire just for those earning more than $1m - but this was scrapped because of lack of support from his own party.
This whole issue has been characterised by brinkmanship, with neither side wanting to blink first. But faced with the possibility of going over the cliff, even the most militant Republicans agreed to what became the final deal.
That would have meant a recession for the US economy and a sudden jump in taxes for every American - perhaps not the best tactic to win votes.
What is the deal?
The deal is a patchwork of short-term and permanent measures.
Firstly, taxes rise for families making more than $450,000 and individuals above $400,000 a year. The rest stay at what they are now, starting at 10% for those earning under $9,000.
What this in fact means is that the Bush tax cuts from 2001 have now become permanent for everyone but the richest 2% of Americans.
But Mr Obama's two-percentage-point cut to payroll taxes from 2010 is now gone. It had lowered to 4.2% the employee contribution to Social Security, allowing workers to keep more of their gross pay. Employee payroll taxes will now rise back to 6.2%.
There is a one-year extension for unemployment benefits, affecting two million people and costing $30bn.
The so-called Alternative Minimum Tax will be permanently changed to link it to inflation, meaning that many middle-class earners will now not be taxed. The measure was designed to tax the wealthiest.
There are also increases in inheritance taxes - from 35% to 40% after the first $5m for an individual and $10m for a couple - and rises in capital gains taxes, affecting some investment income of up to 20% - less than the 39.6% that would prevail without a deal.
Tax cuts from 2009 - such as a child credit and credit for attending university - are extended for five more years.
And - crucially - $110bn worth of military and government spending cuts are postponed until March, pending further discussions on the budget. Republicans oppose cuts to the military.
What happens next?
Well, there is the question of the world's largest economy running out of money.
The US was supposed to reach the debt ceiling - the total amount of debt that the government can borrow - on 31 December. It is currently set at $16.394tn.
The Treasury secretary said that he would be able to create about $200bn in wiggle room that would normally last about two months and postpone the date when the US government fails to pay off its obligations - not coincidentally to the point when Democrats and Republicans have postponed their next deadline.
So March is the new December.
The debt ceiling was not part of the conversation over the fiscal cliff - probably because politicians knew they would never be able to agree on that and taxes.
During the last stalemate over the debt ceiling, ratings agency Standard & Poor's downgraded the country's top-notch AAA credit rating to AA+ for the first time ever. More ratings cuts are likely to happen.
No matter what happens, the US will have to raise the debt ceiling again in the coming months. The question is by how much - and what the Republicans extract from Mr Obama in return for the extension to the ceiling.
There is then the possibility of politicians in the US having these fiscal fights constantly over the next few years.
What would have happened if we had sailed over the cliff?
This is now a moot point, but the stakes were high.
Many observers had said the combination of spending cuts and tax rises would have amounted to a 4-5% cut in the country's output, wiping trillions off the value of an already fragile economy.
The IMF had calculated that the immediate neighbours of the US, such as Canada and Mexico, stood to lose the most from the fiscal cliff.
"But China and several advanced countries would also suffer up to one quarter of the hit taken by US growth," it added. China is the world's second-largest economy.
It also predicted a drop in commodity prices - of 6-12% for energy and 3-6% for non-energy such as food prices - would affect exporters of these goods.
For most markets, the US remains the largest importer, so any drop in demand is felt throughout the world.
But it is worth noting that many of these factors - a weakening of the US economy and a subsequent painful knock-on for the rest of the world - could still be felt in a milder way if the debt ceiling spat becomes nasty.