Embarrassment notwithstanding, the Senate forged a bipartisan deal that House Speaker John Boehner said he would put up for an 11th hour vote.
The U.S. Treasury Department had said that it would have to default on various payments starting Oct. 17 if no deal on the debt ceiling had been reached by then.
It was widely acknowledged that the Treasury Department had ways to avoid an immediate default, but the risks of a default would at least escalate dramatically on Thursday, many experts have said.
On Wall Street, the Dow Jones industrial average rebounded, gaining 205.82 points or 1.36 percent to 15,373.83. The Standard & Poor's 500 gained 23.48 or 1.38 percent to 1,721.54 and the Nasdaq added 45.42 points or 1.2 percent to 3,839.43.
On the New York Stock Exchange, 2,474 issues advanced while 613 declined on volume to 3.5 billion shares traded.
In Asia, the Nikkei 225 index in Tokyo closed up 0.18 percent to 14,467.14. The Hang Seng index in Hong Kong shed 0.46 percent to 23228.33. The Shanghai composite index in China lost 1.81 percent to 2,193.07.
In Europe, the FTSE 100 in London added 0.34 percent to 6,571.59. The German DAX gained 0.47 percent to 8,846 and the French CAC 40 dropped 0.29 percent to 4,243.72.
On currency markets, the euro fell to $1.3535 and the dollar rose to 98.78 yen. On the Comex division of the New York Mercantile Exchange, gold added $8.60 to $1,281.80 per troy ounce while silver gained 21.4 cents to $21.405.
On the Chicago Board of Trade, corn for December delivery lost 1 1/2 cents to $4.42 per bushel. November contract soybeans added 11 cents to $12.78. Wheat for December lost 3 3/4 cents to $6.82.