WASHINGTON - 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, the Senate and House of Representatives each passed the spending measure after Republicans dropped efforts to link the legislation to changes in President Barack Obama's signature healthcare law.Obama vowed to sign the bill and begin reopening the government "immediately."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.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 in early Thursday trade.Taking the podium in the White House briefing room after the Senate vote and just before the House took up the measure, 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," Obama said. "We've got to get out of the habit of governing by crisis."The stand-off 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.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.The Democratic-led Senate overwhelmingly passed the measure on a 81-18 vote, and the Republican-controlled House followed suit 285 to 144, clearing the way for Obama to sign it into law no later than Thursday, when the Treasury says it will hit the $16.7 trillion debt ceiling.Fully reopening the government was expected to take several days. While essential functions like defense and air traffic control have continued, national parks and agencies like the Environmental Protection Agency have been largely closed.