US President Barack Obama has ratified a bill approved by Congress to reopen the federal government and raise the country's debt ceiling, just hours before a critical deadline.
The president has succeeded in defeating the Republicans in a 16-day long battle and kept almost all the features of his proposed healthcare law dubbed 'Obamacare'.
Earlier, Senate majority leader Harry Reid and minority leader Mitch McConnell agreed on a last-minute deal to end the fiscal impasse and the bill was put to vote in the Senate and the House of Representatives.
The Senate voted 81-18 and the House voted 285-144 in favour of the deal.
"There's a lot of work ahead of us. We need to earn back the trust of the American people that's been lost over the past few weeks," Obama said before signing the bill.
The Republican-led House of Representatives accepted the Senate deal to avert a 17 October deadline to raise the country's debt ceiling of $16.7tn (£10.5tn, €12.3tn).
The absence of a deal would have resulted in the country defaulting on its bills, a major blow to its international reputation.
Earlier, credit rating agency Fitch placed its top rating on US debt under review for a possible downgrade, saying "the political brinkmanship and reduced financing flexibility could increase the risk of a US default."
The prolonged talks over raising the debt ceiling undermined the "confidence in the role of the US dollar as the preeminent global reserve currency," Fitch had said.
Republicans Admit Defeat
Hundreds of thousands of federal employees were forced to go on unpaid leave and government offices were closed after the Senate failed to pass the budget for 2014. The Republicans had wanted Obama to modify or eliminate his signature healthcare programme in order to pass the bill.
However, their demand was not taken care of in the fresh agreement, except for one minor change in the programme that requires individuals and families on benefits to verify their incomes in order to qualify.
"We fought the good fight, we just didn't win," Republican House speaker John Boehner said.
Meanwhile, White House press secretary Jay Carney told reporters "there were no winners here."
Fresh Round of Negotiations
Under the new deal, the Treasury will have authority to continue borrowing through to 7 February, and the government will be funded through to 15 January.
Obama is planning a fresh round of negotiations with Congress members before those deadlines.
"Hopefully next time won't be in the 11th hour," he said.
Ratings firm Standard & Poor's earlier estimated that the partial federal closure had cost the US economy $24bn and noted the problem would result in a significant reduction in fourth-quarter growth.