The US Congress has passed a bill to reopen the government and raise the federal debt limit, with hours to spare before the nation risked default.
The Democratic-controlled Senate’s bipartisan compromise won approval by 81 votes to 18.
The bill was then passed by 285-144 in the House of Representatives, whose Republican leadership begrudgingly agreed to support the measure.
It came hours before the deadline to raise the $16.7tn (£10.5tn) limit.
The bill yanks the US back from the brink of a budgetary abyss by extending the treasury’s borrowing authority until 7 February.
It also funds the government to 15 January, reopening closed federal agencies and bringing hundreds of thousands of furloughed employees back to work.
‘Governing by crisis’
Shortly after Wednesday evening’s Senate vote, President Barack Obama told reporters at the White House he would swiftly sign the bill into law.
US lawmakers must “earn back the trust of the American people”, he said.
“We’ve got to get out of the habit of governing by crisis,” the Democratic president added.
“My hope and expectation is everybody has learned there’s no reason why we can’t work on the issues at hand, why we can’t disagree between the parties without still being agreeable and make sure that we’re not inflicting harm on the American people when we do have disagreements.”
Also speaking after the first vote, Senate Democratic Majority leader Harry Reid said: “Let’s be honest, this is pain inflicted on a nation for no good reason and we cannot, cannot make the same mistake again.”
In the House, the Democratic caucus was joined by a number of Republicans in voting for the bill.
The US Treasury has been using what it called “extraordinary measures” to pay its bills since the nation reached its current debt limit in May.
It said those methods would be exhausted by 17 October, leaving the US unable to meet all of its debt and other fiscal obligations.
Politicians, bankers and economists had warned of dire global economic consequences unless an agreement to raise the US government’s borrowing limit was reached.
Meanwhile, ratings firm Standard & Poor’s said on Wednesday that the partial US government shutdown, the first in 17 years, had already shaved $24bn from the American economy and would cut growth significantly in the fourth quarter.
Spurred on by hardline conservatives, congressional Republicans triggered the standoff on 1 October when they forced the shutdown by demanding that President Obama defund or delay his signature healthcare overhaul.
But under the compromise just passed, the law commonly known as Obamacare escapes relatively unscathed.
Congressional Republicans, who have borne the brunt of blame in opinion polls for the budget row, conceded defeat on Wednesday.
“We fought the good fight,” Republican House Speaker John Boehner said in an interview with an Ohio radio station. “We just didn’t win.”
Meanwhile, the political autopsy has already begun.
“This has been a really bad two weeks for the Republican Party,” Republican Senator Lindsey Graham said.
Senator John McCain, who was the party’s 2008 presidential nominee, told the upper chamber floor the budget standoff had been “one of the more shameful chapters I have seen in the years I have spent here in the Senate”.