Government shutdown over as Congress passes 11th-hour deal (VIDEOS)

With bipartisan support that's been lacking in recent weeks, the Senate and then the House passed legislation late Wednesday to avoid US default and end the nation's second-longest government shutdown on record.

Senate Majority Leader Harry Reid holds a news conference about the payroll tax cut. The Senate late Wednesday passed a bill to end the government shutdown and avoid US default after more than two weeks of bickering among House and Senate leaders. (Chip Somodevilla/AFP/Getty Images)

In a show of bipartisanship lacking in recent weeks, the Senate and then the House passed legislation Wednesday night to end a 16-day government shutdown that furloughed thousands of workers and put the US within hours of default.

The legislation, drafted at the 11th hour by a bipartisan group of 14 senators, passed 81-18 in the Senate and 285-144 in the House.

It then went to President Barack Obama, who said he would sign it immediately.

"There’s a lot of work ahead of us, including our need to earn back the trust of the American people that’s been lost over the last few weeks," Obama said Wednesday night. "And we can begin to do that by addressing the real issues that they care about."

The legislation extends the nation's debt ceiling through Feb. 7, and funds the government through Jan. 15. It also pays more than two million federal workers — those who had remained on the job and those who had been furloughed.

Perhaps more importantly for Democrats, it makes no major changes to Obama's health care reform law — a repudiation to Republicans who had sought to defund the measure.

Wednesday's quick action was in stark contrast to the protracted brinksmanship of recent weeks that led to the shutdown and near default.

The deal, which also sets up a conference committee to hammer out broader budget issues, is generally seen as a victory for Obama and Democrats.

The proposal was crafted by a bipartisan Senate group only after House Speaker John Boehner was unable to get his own Republican caucus to support a House GOP version that lacked any substantive measures sought by the political right beyond extending current spending levels until Jan. 15.

Sen. John McCain, who had repeatedly warned fellow Republicans not to link Obamacare demands to government spending or the debt limit, said earlier 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," the four-term senator said.

"We fought the good fight; we just didn’t win," House Speaker John A. Boehner said in an interview with conservative radio host Bill Cunningham.

Obama, who addressed the country on Thursday, however, didn't view the resoluation as a victory.

"Let's be clear. There are no winners here," he said. "These last few weeks have inflicted completely unnecessary damage to our economy."