Congress has passed a measure to avert a threatened US default and reopen the federal government, a move intended to end a prolonged fiscal crisis that gripped the US and threatened the world economy.

The 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 government shutdown early next year.

Both the Democrat-controlled Senate and Republican-controlled House of Representatives approved the plan, with the Senate passing the measure by 81 votes to 18 and the House 285 votes to 144.

President Barack Obama signed the bill before Thursday's deadline for Congress to increase the federal debt limit. He applauded the Senate compromise.

Speaking at the White House Wednesday evening, he said that they could "begin to lift this cloud of uncertainty and unease from our businesses and from the American people".

"We need to get out of the habit of governing by crisis," Obama said, speaking at the White House.

He announced his intentions to move forward this year and work on new bills, including reforming the "broken" immigration system, passing a farm bill, and working on a "sensible" budget.

But House Speaker John Boehner did not agree to the move quietly.

Although he said that he and his fellow Republicans "fought the good fight and did not win", he added that they were not giving up on the fight to bring down US debt and cripple the president's signature health care overhaul.

"Our drive to stop the train wreck that is Obama's health-care law will continue," Boehner said in a statement.

With the deal announced, US stock indexes jumped by more than one percent in trading late in the day.

Senate Majority Leader Harry Reid and Republican leader Mitch McConnell announced the fiscal agreement on the Senate floor earlier on Wednesday.

Reid thanked McConnell for working with him to end what had become one of the nastiest partisan battles in recent Washington history.

"This is a time for reconciliation," he said.

Al Jazeera's Patty Culhane, reporting from Washington, said the deal is only temporary.

"Basically, in the next three to four months, leaders from both parties are going to come up with some sort of budget agreement," she said.

"This is something they have tried to do five times before and they've always been unsuccessful."

Steep decline

A long line of polls charted a steep decline in public approval for Republicans, who were left with little to show for their fight; in political terms, the final agreement was almost entirely along lines Obama had set when the impasse began last month.

The crisis began on October 1 with a partial shutdown of the federal government after House Republicans refused to accept a temporary funding measure unless Obama agreed to defund or delay his health care law.

It escalated when House Republicans also refused to move on needed approval for raising the amount of money the Treasury can borrow to pay US bills, raising the specter of a catastrophic default.

Obama vowed repeatedly not to pay a "ransom" in order to get Congress to pass normally routine legislation.

The hard-right "Tea Party" faction of House Republicans, urged on by conservative Texas Republican Ted Cruz in the Senate, had seen both deadlines as weapons that could be used to scuttle Obama's Affordable Care Act.

But Cruz said after the deal was announced that he would not block the vote, a key concession that indicated that both chambers would act by day's end.