Updated 12:31 a.m. President Barack Obama signed a last-minute Congressional deal early Thursday morning to avert a damaging debt default and to reopen the government after a more than two-week shutdown.
The Office of Management and Budget said previously furloughed federal workers should report to work Thursday morning and Congressional leaders began to appoint budget negotiators to find a longer term budget solution.
The U.S. House of Representatives voted to pass the stopgap bill shortly after 10 p.m. Wednesday. It got through relatively easily: 285 members voted for the legislation and 144 against it. After much opposition, House Speaker John Boehner was one of 87 Republicans to vote for the plan; Representative Paul Ryan was among those who voted against it.
The Senate passed the same bill 81 to 18 shortly after 8 p.m.
"I want to thank the leaders of both parties for getting us to this point," Obama said shortly after the Senate vote. "We'll begin reopening our government immediately, and we can begin to lift this cloud of uncertainty and unease from our businesses and from the American people."
Treasury Secretary Jack Lew was also pleased.
"We welcome the bipartisan action Congress is taking to resolve this crisis," Lew said in a statement late Wednesday. "At the same time, we remain committed to reaching agreement on a balanced fiscal package that will create jobs, grow our economy, and put us on a path toward long-term fiscal sustainability. Without question, it will require difficult choices."
While the deal in Congress is a temporary solution that sets up another showdown early next year, Wall Street reacted positively.
Major U.S. stock indexes rose more than 1 percent Wednesday on optimism that lawmakers were finally reaching a deal to end the 16 day fiscal impasse. U.S. stock futures also rose in after-hours trading.
(Read more: El-Erian: What follows this Congressional deal?)
Earlier Wednesday, Senate Majority Leader Harry Reid, the top Democrat, and Republican leader Mitch McConnell announced an agreement after days of bickering. Key Republican opponents Senator Ted Cruz of Texas and Boehner said they would not block the deal.
Cruz nonetheless called the deal "terrible" shortly before voting no. "The fight against Obamacare must continue in the face of Washington's apathy," he said.
Weeks of bitter fighting among Democrats and Republicans over President Obama's signature healthcare reform law led to a partial government shutdown on Oct. 1, sidelining hundreds of thousands of federal workers. Cruz and other Republicans backed by the conservative, small government Tea Party movement want to repeal or delay the healthcare law.
The initial fight over healthcare turned into a bigger argument over the debt ceiling, threatening a default that would have reverberations around the world.
The Club for Growth, a conservative advocacy group that backs lower government spending, urged the Senate and House to vote "no" on a deal.
(Read more: CNBC explains the debt ceiling)
"If we don't get a default, it would be like Y2K. People were staying up all night worried about what would happen during that deadline. Then nothing happened," said David Keeble, global head of interest rate strategy with Credit Agricole Corporate & Investment Bank in New York, referring to worries about the millennium computer bug in 2000.
Senator John McCain, whose fellow Republicans triggered the crisis with demands that President Barack Obama's signature "Obamacare" healthcare law be defunded, said 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 repeatedly warned Republicans not to link their demands for Obamacare changes to the debt limit or government spending bill.
Lawmakers were racing against time. While analysts and U.S. officials say the government will still have roughly $30 billion in cash to pay many obligations for at least a few days after Oct. 17, the financial sector may begin to seize up if the deal is not finalized in both chambers.
"Today is definitely not the day to be conducting any serious business as traders across the globe will be hypnotized by their TVs/terminals and anxiously waiting for something to hit the news wires," Jonathan Sudaria, a trader at Capital Spreads in London, wrote in a client note Wednesday.
Fitch Ratings has said it could cut the U.S. sovereign credit rating from AAA, citing the political brinkmanship over raising the debt ceiling.
The deal that emerged on Wednesday basically give Obama what he has demanded for months: A straight-forward debt limit hike and government funding bill.
The deal extended U.S. borrowing authority until Feb. 7, although the Treasury Department would have tools to temporarily extend its borrowing capacity beyond that date if Congress failed to act early next year. It would also fund government agencies until Jan. 15.
The deal includes some income verification procedures for those seeking subsidies under the healthcare law, but Republicans surrendered on their attempts to include other changes, including the elimination of a medical device tax used to help pay for it.
The budget deadlock led to federal agency shutdowns at the beginning of the fiscal year on Oct. 1 as Obama and his fellow Democrats stood firm against changing the healthcare law.
Uncertainty over the shutdown and the debt ceiling have already taken a toll on the economy and on confidence in U.S. assets.
Richard Fisher, the hawkish president of the Federal Reserve Bank of Dallas, told Reuters on Tuesday that "reckless" U.S. fiscal policy will likely force the Federal Reserve to stand pat on monetary policy this month rather than reducing bond purchases the central bank has used to help support the economy.