NEW YORK (Reuters) - Stocks rose in another turbulent session on Tuesday as a pullback in oil prices eased worries about consumer and business spending, while financial shares gained after the Fed chairman said he may keep open a lifeline for banks.

Traders work on the floor of the New York Stock Exchange, July 8, 2008. REUTERS/Brendan McDermid

Technology and retail companies bounced back after a sharp sell-off last week, helping the S&P 500 stave off a bear market for another day. Wal-Mart (WMT.N) was the biggest boost to the Dow, and Apple (AAPL.O) rose ahead of Friday’s new iPhone launch, helping the Nasdaq.

The positive mood continued after the closing bell, with aluminum producer Alcoa Inc (AA.N) posting stronger-than-expected results. Its shares rose more than 5 percent after the bell.

Financial shares climbed after Federal Reserve Chairman Ben Bernanke said in a speech that the U.S. central bank may extend emergency lending facilities for big Wall Street banks past year-end, showing the Fed is determined to stop the housing-inspired credit crisis from wreaking further havoc on the economy.

Treasury Secretary Henry Paulson added to that optimism when he said Treasury was working on ways to shore up mortgage financing. And JPMorgan Chase & Co’s (JPM.N) chief executive, Jamie Dimon, said in a speech that the future of the U.S. economy is bright, though more short-term suffering is ahead.

“You had two major officials today who made clear that they will do everything possible to shore up the housing market,” said Andrew Harding, chief investment officer for fixed-income at Allegiant Asset Management in Cleveland.

The Dow Jones industrial average .DJI jumped 152.25 points, or 1.36 percent, at 11,384.21, while the Standard & Poor's 500 Index .SPX gained 21.39 points, or 1.71 percent, to 1,273.70.

The Nasdaq Composite Index .IXIC rose 51.10 points, or 2.28 percent, at 2,294.42, snapping a 3-day losing streak.

Fannie Mae FNM.N and Freddie Mac FRE.N shares rebounded from 15-year lows, after the mortgage finance companies’ main regulator said proposed accounting rules should not force them to raise more capital. The comments eased fears the companies’ value would be diluted by a massive capital increase.

Fannie Mae shares rose 11.9 percent to $17.62 and Freddie Mac shares jump 13 percent to $13.46.

General Electric (GE.N) shares rose 3.5 percent to $28.06, and were the top boost to the S&P 500, just days before the economic bellwether releases its second-quarter earnings. Wal-Mart added 3.9 percent to $59.11.

Apple gained 2.5 percent to $179.55. Its new iPhone sold out online in Britain ahead of Friday’s launch, defying general consumer gloom. Google (GOOG.O) rose nearly 2 percent to $554.53 and IBM (IBM.N) was also up almost 2 percent to $123.88.

An index of S&P financial shares .GSPF rose 5.7 percent.

JPMorgan shares rose 5.1 percent to $35.77.

A drop of more than 4 percent in U.S. crude prices made energy companies the top drags on the S&P and the Dow.

Exxon Mobil Corp (XOM.N) slid 1.2 percent to $85.94, Chevron Corp (CVX.N) also fell 1.1 percent to $95.79, and oil services company Schlumberger (SLB.N) declined 3.3 percent to $96.19.

Economic data released on Tuesday showed consumers still hurting, however. Pending sales of previously owned homes plummeted 4.7 percent in May, and sales at chain stores, though improved last week, were weaker in June.

Trading was moderate on the New York Stock Exchange, with about 1.7 billion shares changing hands, below last year’s estimated daily average of roughly 1.9 billion, while on Nasdaq, about 2.49 billion shares traded, above last year’s daily average of 2.17 billion.

Advancing stocks outnumbered declining ones by about 2 to 1 on NYSE and Nasdaq.