NEW YORK -- Wall Street finally got the deal it's been waiting for.
A last-minute agreement to keep the U.S. from defaulting on its debt and reopen the government sent the stock market soaring Wednesday, lifting the Standard & Poor's 500 index close to a record high.
The deal was reached just hours before a deadline to raise the nation's $16.7 trillion debt limit. The Senate agreed to extend government borrowing through Feb. 7 and to fund the government through Jan. 15.
The agreement follows a month of political gridlock that threatened to make America a deadbeat and derail global markets, which depend on the U.S. to pay its bills. American government debt is widely considered the world's safest investment.
Markets stayed largely calm throughout the drama in Washington, with the S&P 500 actually gaining 2.4 percent since the shutdown began Oct. 1, after House Republicans demanded changes to President Barack Obama's health care law before passing a budget.
Wall Street gambled that politicians wouldn't let the U.S. default, a calamity economists said could paralyze lending and push the economy into another recession.
"We knew it was going to be dramatic, but the consequences of a U.S. default are just so severe that the base case was always that a compromise was going to be reached," said Tom Franks, a managing director at TIAA CREF, a large retirement funds manager.
It will be harder for Wall Street to get an up-to-date view of the economy because the partial government shutdown that began Oct. 1 has kept agencies from releasing key reports on trends like hiring.
Despite broad confidence that the political parties would strike a deal, the Dow went through rough patches over the past month, at one point falling as much as 900 points below an all-time high reached Sept. 18. The Dow has seen seven triple-digit moves in the past 10 trading days.
On Wednesday, the Dow Jones climbed 205.82 points, or 1.4 percent, to 15,373.83. The S&P 500 gained 23.48, or 1.4 percent, at 1,721.54, only 4 points below its record close of 1,725.52 on Sept. 18.
The Nasdaq composite climbed 45.42, or 1.2 percent, to 3,839.43.