The S&P 500 brushed up against a bear market on Tuesday, but investors rushed in to buy technology and other beaten-down sectors and the index posted its largest gain in more than a week.

The broad U.S. market index has fallen nearly 18 percent in the past four months, hurt by sluggish economic growth worldwide and ballooning deficits in Greece and other euro zone nations.

But the depth of those losses brought in bargain hunters late in Tuesday's session. Chip makers and large-cap techs led the way, even with bellwether Apple dropping 0.6 percent after the unveiling of its latest phone didn't live up to the hype. Apple shares, earlier, fell more than 5 percent.

We're buying some stocks, sticking to companies with strong balance sheets, with global if not emerging market focus, certainly not in the financial services area, said Kim Forrest, senior equity research analyst at Fort Pitt Capital Group in Pittsburgh.

We're looking for opportunities to buy for holding at reduced prices, she said. The sad fact is that we don't know what tomorrow brings.

The Dow Jones industrial average <.DJI> gained 153.41 points, or 1.44 percent, to 10,808.71 at the close. The Standard & Poor's 500 Index <.SPX> rose 24.72 points, or 2.25 percent, to 1,123.95. The Nasdaq Composite Index <.IXIC> climbed 68.99 points, or 2.95 percent, to 2,404.82.

The market pared losses before midday after reassuring comments from Federal Reserve Chairman Ben Bernanke, who told Congress the Fed was prepared to take more steps to help a fragile recovery.

Still, the euro zone's frail financial system is likely to keep the market on edge.

France and Belgium came to the rescue of heavy sovereign debt holder Dexia on Tuesday in the first government bailout of a European bank in the euro-zone debt crisis. Traders cited talk that European finance ministers agreed to prepare action to safeguard their banks as helping the market bounce back late.

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.

I don't think anyone really believes Greece is not going to default at least on their short-term debt, said Fort Pitt Capital's Forrest.

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 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.

Among Nasdaq advancers, shares of Sears Holdings gained 11.7 percent to $63.94.

About 12.9 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.

(Additional reporting by Caroline Valetkevitch; Editing by Jan Paschal)