The US Congress on Wednesday approved an 11th-hour deal to end a partial government shutdown and pull the world's biggest economy back from the brink of a historic debt default that could have threatened financial calamity.
Capping weeks of political brinkmanship that had unnerved global markets, President Barack Obama quickly signed the spending measure, which passed the Senate and House of Representatives after Republicans dropped efforts to use the legislation to force changes in his signature healthcare law.
The White House budget office told hundreds of thousands of federal workers, the bulk of whom had been idle for the past 16 days, to be ready to return to work on Thursday.
The down-to-the-wire deal, however, offers only a temporary fix and does not resolve the fundamental issues of spending and deficits that divide Republicans and Democrats. It funds the government until January 15 and raises the debt ceiling until February 7, so Americans face the possibility of another bitter budget fight and another government shutdown early next year.
With the deadlock broken just a day before the US Treasury said it would exhaust its ability to borrow new funds, US stocks surged on Wednesday, nearing an all-time high. Share markets in Asia also cheered the deal.
Taking the podium in the White House briefing room on Wednesday night, Obama said that with final congressional passage, "We can begin to lift this cloud of uncertainty and unease from our businesses and from the American people."
"Hopefully next time it won't be in the 11th hour. We've got to get out of the habit of governing by crisis," Obama said. He outmanoeuvered Republicans by holding firm in defense of "Obamacare" to win agreement, with few strings attached, to end the 16-day shutdown.
World Bank President Jim Yong Kim said "the global economy dodged a potential catastrophe" with congressional approval of the deal to raise the $16.7 trillion US debt ceiling.
The standoff between Republicans and the White House over funding the government forced the temporary lay-off of hundreds of thousands of federal workers from October 1 and created concern that crisis-driven politics was the "new normal" in Washington.
While essential functions like defense and air traffic control continued during the crisis, national parks and agencies like the Environmental Protection Agency have been largely closed.
Senator John McCain, whose fellow Republicans triggered the crisis with demands that the Democratic president's "Obamacare" healthcare reform law be defunded, said earlier on Wednesday the deal marked the "end of an agonizing odyssey" for Americans.
"It is one of the most shameful chapters I have seen in the years I've spent in the Senate," said McCain, who had warned Republicans not to link their demands for Obamacare changes to the debt limit or government spending bill. Polls showed Republicans took a hit in public opinion over the standoff.
In the end, the Democratic-led Senate overwhelmingly passed the measure on a 81-18 vote, and the Republican-controlled House followed suit 285 to 144. Obama signed the 35-page bill just after midnight.