Investors rushed in to buy technology and other beaten-down sectors as the S&P 500 dipped in and out of a bear market on Tuesday, and a late rally drove the index to its largest gain in more than a week.

Markets once again turned on news out of Europe.

Reports that European finance ministers agreed to prepare action to safeguard their banks, following the first lender bailout as a result of the crisis, were cited as giving stocks a boost heading into the close.

Others pinned the comeback on technical levels and on bargain hunting after the broad S&P 500 briefly fell more than 20 percent from its 2011 closing high set four months ago.

To me, it looked mostly technical. It looked like the capitulation on the sell side, said Keith Springer, president of Springer Financial Advisors in Sacramento, California.

He said the reports out of Europe just added to the buying frenzy that had started earlier.

You could see it (the market) starting to turn anyway and that gave people an excuse to buy, he said.

Chip makers and large-cap technology companies led the way even after Apple Inc fell 0.6 percent to $372.50 as the unveiling of its latest iPhone didn't live up to the hype. Apple shares had earlier fallen more than 5 percent.

Volume increased late in the day - with nearly 15 percent of the day's composite trading taking place in the last half hour of the session. The Dow industrials rose 345 points in the last hour of trading.

The Dow Jones industrial average <.DJI> gained 153.41 points, or 1.44 percent, to 10,808.71. The S&P 500 <.SPX> gained 24.72 points, or 2.25 percent, to 1,123.95. The Nasdaq Composite <.IXIC> gained 68.99 points, or 2.95 percent, to close at 2,404.82.

Despite the large gains, it is still not clear whether the latest reports mean there is progress in Europe's effort to keep its sovereign debt crisis from spreading out of Greece and into the banking system.

The European finance ministers put their heads together for a plan to shore up their banks after collapsing confidence in municipal lender Dexia forced France and Belgium to rush to its aid.

The Dexia bailout came as euro-zone finance ministers delayed a vital aid payment to debt-stricken Greece, which could run out of cash shortly.

Investors fear that a Greek default will force banks to write down billions of dollars from their books and kick-start another credit crisis like the one that brought lending to a halt three years ago and generated a recession.

The U.S. bank sector index <.GSPF>, down nearly 30 percent since the 2011 market high hit on April 29, posted strong gains. The index finished the session up 4.1 percent.

Morgan Stanley shares gained 12.3 percent to $14.01 but are still off 48.5 percent this year. Shares of Bank of America rose 4.2 percent Tuesday to $5.76.

About 13.1 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq -- more than 60 percent above the daily average so far this year of 8 billion shares.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of about 3 to 2, while on the Nasdaq, about three stocks rose for every one that fell.

(Reporting by Rodrigo Campos; additional reporting by Chuck Mikolajczak; Editing by Jan Paschal)