Senate Minority Leader Mitch McConnell, R-Ky., center, emerges from a closed-door meeting with Republican senators at the Capitol in Washington, Wednesday, Oct. 16, 2013. McConnell and his Democratic counterpart, Senate Majority Leader Harry Reid, D-Nev., reached last-minute agreement Wednesday to avert a threatened Treasury default and reopen the government after a partial, 16-day shutdown. Sen. Johnny Isakson, R-Ga., center right, speaks with Sen. Saxby Chambliss, R-Ga., right. (AP Photo/J. Scott Applewhite)

WASHINGTON (AP) -- Senate leaders announced last-minute agreement Wednesday to avert a threatened Treasury default and reopen the government after a partial, 16-day shutdown. Congress raced to pass the measure by day's end.

The Dow Jones industrial average soared on the news that the threat of default was fading, flirting with a 200-point gain in morning trading.

"This is a time for reconciliation," said Senate Majority Leader Harry Reid of the agreement he had forged with the GOP leader, Sen. Mitch McConnell of Kentucky.

It was a jubilant moment in the chamber, which on Tuesday was forced to sit back and watch as the effort by House GOP leaders for a bill collapsed in disarray.

McConnell said that with the Senate accord, Republicans had sealed a deal to have spending in one area of the budget decline for two years in a row, adding, "we're not going back."

One prominent tea party lawmaker, Sen. Ted Cruz of Texas, said he would oppose the plan, but not seek to delay its passage.

That was a key concession that signaled a strong possibility that both houses could act by day's end. That, in turn, would allow President Barack Obama to sign the bill into law ahead of the Thursday deadline that Treasury Secretary Jacob Lew had set for action to raise the $16.7 trillion debt limit.

While the deal could meet resistance from conservatives in the Republican-controlled House, the Democratic Leader, Rep. Nancy Pelosi of California, supports the plan and says her rank and file is expected to vote for it in overwhelming numbers. That raised the possibility that more Democrats than Republicans would back it, potentially causing additional problems for House Speaker John Boehner as he struggles to manage his tea party-heavy majority.

After abandoning their own plan on Tuesday, House members quietly awaited Senate action, resigned to the likelihood that they would have to back the deal or plunge the nation into default. The only silver lining was the promise that it would be their last vote for the week after three straight weekends in Washington.

Officials said the proposal called for the Treasury to have authority to continue borrowing through Feb. 7, and the government would reopen through Jan. 15.

The White House welcomed the compromise and spokesman Jay Carney said the president looked forward to signing it into law.

In political terms, the final agreement was almost entirely along lines Obama had set when the impasse began last month. Tea party conservatives had initially demanded the defunding of the health care law as the price for providing essential federal funding.

Under a strategy set by Obama and Reid, Democrats said they would not negotiate with Republicans in exchange for performing what the White House called basic functions of keeping the government in operation and preventing Treasury from defaulting on its obligations.

A long line of polls charted a steep decline in public approval for Republicans in the course of what Sen. John McCain, R-Ariz., pronounced a "shameful episode" in the nation's history.

Wednesday's developments came one day before the deadline Lew had set for Congress to raise the current $16.7 trillion debt limit. Without action by lawmakers, he said, Treasury could not be certain it had the ability to pay bills as they come due.

In addition to raising the debt limit, the proposal would give lawmakers a vote to disapprove the increase. Obama would have the right to veto their opposition, ensuring he would prevail.

House and Senate negotiators would be appointed to seek a deficit-reduction deal. At the last minute, Reid and McConnell jettisoned a plan to give federal agencies increased flexibility in coping with the effects of across-the-board cuts. Officials said that would be a topic for the negotiations expected to begin shortly.

The deal would provide back pay to the 800,000 federal workers affected by the shutdown, including half who have been idled for more than two weeks.

Despite initial Republican demands for the defunding of the health care law often derided as "Obamacare," the pending agreement makes only one modest change touching on the program. It relates to a requirement that individuals and families seeking subsidies to purchase coverage verify their incomes before qualifying.

Story continues