Washington (AFP) - The United States dodged the ignominy of a disastrous debt default when Congress passed and President Barack Obama signed a bill extending the nation's borrowing authority and ending a two-week government shutdown.
After weeks of tumultuous debate, the measure passed late Wednesday with less than two hours to go until October 17, the date from which the Treasury had warned it might not be able to pay its bills.
The last-gasp plan will stave off the most pressing crisis by extending the US Treasury's borrowing authority until February 7.
Obama signed the bill in the wee hours of Thursday, shortly after the Congressional green light.
Hundreds of thousands of federal workers were instructed to "reopen offices in a prompt and orderly manner," according to a statement from Office of Management and Budget Director Sylvia Mathews Burwell.
"Thank you and your teams for your service and your continued work on behalf of the American people under the challenging circumstances of the past few weeks," Mathews wrote.
Lawmakers also reached agreement on funding government through January 15.
Even before the acrimonious battle reached its climax with the House vote, Obama said he would sign the bill right away and warned that Washington must stop governing by crisis.
US leaders needed to "earn back" the trust of the American people in the aftermath of the crisis, Obama said.
"We'll begin reopening our government immediately, and we can begin to lift this cloud of uncertainty and unease from our businesses and from the American people."
With a bitterly divided Congress locked in stalemate for a month, Senate Majority Leader Harry Reid worked behind closed doors with his Republican rival Senator Mitch McConnell to craft the compromise that had eluded Washington.
"The bipartisan Senate rose to the occasion and broke this deadlock," number two Senate Democrat Dick Durbin said.
The mood from many House Republicans was a begrudging acceptance of a deal many of them felt failed to address their desire to rein in outsized federal spending and roll back the president's health care law known as "Obamacare."
House Budget chairman Paul Ryan, who voted against the bill, called it a "missed opportunity."
"Today's legislation won't help us reduce our fast-growing debt," he said. "In my judgement, this isn't a breakthrough. We're just kicking the can down the road."
While the deal was welcomed on Wall Street, with the Dow Jones Industrial Average and the broader S&P 500 index up almost 1.4 percent, the signs of a close-to-humiliating, last-minute bid to avert possible global economic turmoil were plain to see.
The International Monetary Fund's managing director Christine Lagarde, who over the past week had pleaded with US lawmakers to come to their senses, praised them for taking the "necessary step" of lifting the debt ceiling.
"Looking forward, it will be essential to reduce uncertainty surrounding the conduct of fiscal policy by raising the debt limit in a more durable manner," she said.
After the agreement was unveiled, House speaker John Boehner bowed to the inevitable and admitted there were "no reasons" to vote against the bill, while maintaining that Republicans didn't like its terms.
"We fought the good fight, we did everything we could. They just kept saying no, no, no," Boehner said of lawmakers in Obama's Democratic Party.
"Our drive to stop the train wreck that is the president's health care law will continue," Boehner added, apparently seeking to placate Tea Party-backed Republicans.
The legislation would allow government to borrow beyond its current $16.7 trillion debt ceiling to meet its obligations.
It also provides full retroactive pay to those ordered off the job during the shutdown.
The US economy has faced uncharted waters during the more than two-week crisis, with the Treasury saying that from Thursday it would no longer be able to borrow more money and avert a devastating debt default.
Ratings firm Standard & Poor's said the government shutdown had already taken $24 billion out of the economy and will cut growth in the fourth quarter significantly.
House conservatives have thus far thwarted votes on the debt ceiling and on passing a budget, demanding concessions from Obama.
Democrats have refused to allow Republicans to hold those issues to "ransom" with attempts to slash spending or dismantle Obamacare.
But Wednesday's deal includes a mechanism that forces lawmakers into entering long-term budget negotiations, with recommendations due by December 13.
As a sign of good faith regarding what is bound to be a brutal budget battle, Democratic Senate Budget Committee chair Patty Murray said she would sit down for breakfast Thursday with Ryan to discuss the path forward.
US officials and lawmakers are likely to seek to soothe rattled world markets and re-iterate that the full faith and credit of the United States remains intact.
The Fitch ratings agency on Tuesday underlined the seriousness of the situation by putting the US government's AAA credit rating on a downgrade warning.
Major world powers have been left looking on in dismay, unable to do anything to protect their own economic interests, with many deeply invested in US Treasuries -- hitherto seen as a safe haven.China and Japan, which between them hold $2.4 trillion in US Treasuries, have expressed alarm and annoyance at the bitter political partisanship that has caused the weeks-long crisis.