A remarkable end-of-day rally pushed the benchmark S&P 500 higher on Thursday after investors snatched up financial stocks that looked cheap after weeks of pummeling by global credit market turmoil.

Speculation about a possible Federal Reserve interest-rate cut and outside funding for Bear Stearns Cos. dominated the session's final hour, providing much of the fuel for the turnaround. Big gainers included Citigroup and JPMorgan Chase.

With trading volume at a record and volatility near a five-year peak, stocks swung back from steep losses early in the day. The rebound was carried by bank and brokerage shares, with the Standard & Poor's financial sector registering its second-biggest percentage gain in three-and-a-half years.

The Dow industrials clawed back nearly 300 points in the final 45 minutes to finish the session down by less than 16 points. Blue chips' brief burst into the black in the final minutes brought a raucous cheer from traders on the New York Stock Exchange floor.

I think many of the financials are oversold. You're starting to probably get some investors who are taking a longer-term viewpoint and looking for stocks that have gotten beaten up, said Michael Sheldon, chief market strategist at Spencer Clarke in New York.

The Dow Jones industrial average slipped 15.69 points, or 0.12 percent, to end at 12,845.78. But the Standard & Poor's 500 Index gained 4.57 points, or 0.32 percent, to finish at 1,411.27. And the Nasdaq Composite Index was down 7.76 points, or 0.32 percent, at 2,451.07.

Bear Stearns, whose mortgage market losses had rattled the market in recent weeks, jumped nearly 13 percent, its biggest one-day gain in nine years, on speculation it may receive funding from an outside investor.

Also helping financial stocks was news that Fannie Mae remained in talks with regulators about playing a bigger role in supporting the struggling mortgage market.

But even with the late rebound, major indexes have fallen between 8 percent and 10 percent from highs set just four weeks ago.

UGLY FOR MUCH OF THE DAY

Global stocks were roiled for most of the day on fears that tighter credit in the U.S. subprime housing sector will hurt economic growth.

Investor confidence took an early blow from Countrywide Financial Corp. .The biggest U.S. mortgage lender said it had to draw down an entire $11.5 billion bank credit line after it was essentially shut out of other credit markets.

Countrywide ended the day down 11 percent at $18.95 in its sixth consecutive day of losses.

Treasury Secretary Henry Paulson, in a Wall Street Journal interview, seemed to confirm fears that the turmoil in the U.S. housing market would extract a penalty on the growth of the U.S. economy.

But St. Louis Federal Reserve President William Poole, in a Bloomberg news interview, seemed to dash hopes that the Fed would ease any impact with an early rate cut .

For the first time in the month-long slump, the companies bearing the brunt of the losses were those most sensitive to a potential downturn in the economy, such as oil company Exxon Mobil and industrial conglomerate Caterpillar. Shares of Caterpillar fell 2.6 percent to $73.

U.S. crude fell $2.33 to $71 a barrel, partly on concerns the sharp falls in global stock markets could ultimately reduce demand for oil. Exxon Mobil shares fell 1.3 percent to $80.67.

The markets' earlier malaise was deepened by slack economic data. Groundbreaking on new homes slid to the slowest pace in more than 10 years in the United States during July and factory activity in the Mid-Atlantic region stagnated in August, government reports showed.

That initially pushed down the Dow Jones home builders index - but it managed to reverse losses late in the session to finish up 2.3 percent.

The Chicago Board Options Exchange Volatility Index briefly jumped intraday to 37.50, nearly a five-year high, indicating mounting uncertainty among investors on the direction of the stock market heading into August options expiration.

The Federal Reserve added $17 billion of liquidity to the banking system on Thursday, saying it stood ready to inject more money as needed to keep the target rate for fed funds trading around 5.25 percent.

The New York Stock Exchange said on Thursday preliminary transaction volume of 5.73 billion in its U.S. cash equities trading operations on NYSE Group exchanges was a record high.

The Nasdaq also had record total matched volume of 3.73 billion shares traded.

Declining stocks outnumbered advancing ones by a ratio of about 8 to 5 on the NYSE and by 5 to 4 on Nasdaq. (Additional reporting by Caroline Valetkevitch)