WASHINGTON — Congress gave final approval late Wednesday to a budget compromise, ending a 16-day government shutdown and averting the possibility of a default on the nation's bills, as a bitter partisan stalemate concluded with Republicans conceding defeat.

"We fought the good fight," House Speaker John A. Boehner (R-Ohio) said in a Cincinnati radio interview hours before the final vote. "We just didn't win."

President Obama quickly signed the measure.

Republicans had sought the confrontation in hopes that a shutdown and the threat of default would give them leverage to extract concessions from Obama on his signature healthcare law.

In the end, the compromise negotiated by Senate Majority Leader Harry Reid (D-Nev.) and Minority Leader Mitch McConnell (R-Ky.) made no significant changes in the Affordable Care Act.

FULL COVERAGE: The U.S. government shutdown

The deal will suspend the $16.7-trillion limit on the government's debt for several months, giving the Treasury renewed authority to borrow to pay the nation's bills. Officials had said they would be unable to pay them as of Thursday. The measure also will bring hundreds of thousands of federal workers back to work from furloughs.

Federal agencies will start to reopen Thursday morning, but some might not do so until Friday to give managers time to notify workers.

Less than an hour after the House vote, and even before the president signed the bill, Yosemite National Park announced its roads and public areas would reopen immediately. The park's visitor centers and valley campgrounds will open Thursday.

"We are excited to reopen and welcome visitors back to Yosemite," park Supt. Don Neubacher said in a statement. "Autumn is a particularly special season to enjoy Yosemite's colorful grandeur."

After more than two weeks of partisan stalemate, the measure passed easily. The Senate voted 81 to 18, and the House voted 285 to 144 less than three hours later.

"I am very happy: We just completed a bipartisan vote to reopen the government," Reid said immediately after the Senate vote. "Let's move on."

McConnell described the deal as "far less than many of us hoped for, quite frankly, but far better than what some had sought." In remarks introducing the compromise, he urged his party "to unite behind other crucial goals."

PHOTOS: 2013's memorable political moments

More than half of the Republicans in the Senate sided with McConnell and joined all of the Democrats in approving the bill. Eighteen Republican senators, mostly from the party's most conservative wing, voted against it.

In the House, 87 Republicans joined 198 Democrats to pass the bill. The three top members of the GOP leadership — Boehner, Majority Leader Eric Cantor of Virginia and Majority Whip Kevin McCarthy of Bakersfield — were among those voting aye. But 144 Republicans, more than 60% of the conference, opposed them, including Budget Committee Chairman Paul D. Ryan of Wisconsin.

The House vote was punctuated by an outburst on the floor by a woman whom aides said worked in the chamber as a stenographer. "This is not one nation under God," she shouted as she was led away.

In brief remarks at the White House after the Senate vote, Obama promised to sign the bill immediately and start reopening government agencies.

He said he hoped the end of the crisis would give lawmakers a chance to "earn back the trust of the American people" by addressing "real issues" relevant to people's lives. He listed immigration reform, a farm bill and a "sensible budget" as three items Congress could finish this year if members worked together.

Democrats chastised Republicans for shutting down the government for more than two weeks in their bid to kill Obamacare. "We've ended up just where we started, but at a cost, and it never should have been this way," Sen. Charles E. Schumer (D-N.Y.) said.