Stocks rose in volatile trading on Thursday, thanks only to technical factors and options expirations. But raging uncertainty about Greece prevented investors from committing money to the market.

The impending expiration of stock-index futures, single-stock futures, equity options and stock-index options for June -- known as quadruple witching -- created exceptional volatility, pushing the S&P 500 to swing more than 1 percent from its session low to its intraday high.

Greece kept a pall over investor sentiment, even though experts say U.S. banks' exposure to Greek debt may be smaller than many market participants fear.

Still, the market needs resolution of the situation soon, as the lack of a deal to resolve the Greek debt crisis stifles investor confidence and curbs the market's advance.

The big headline is Greece, and it's going to continue to be Greece until there is some clarity or conviction that comes out of there, said Jonathan Corpina, head of NYSE floor operations for Meridian Equity Partners in New York.

Losses were contained, however, as investors looked for value after the recent sell-off. The Dow finished the volatile day with a modest gain and the Nasdaq retraced some ground after falling slightly more than 1 percent in late afternoon trading.

The S&P materials sector <.GSPM> lost 0.9 percent, reflecting a slide in copper prices amid concerns that the U.S. economy may be slowing. For details, see [ID:nN16194354]. Freeport-McMoRan Copper & Gold Inc shed 1.4 percent to $47.85.

The Dow Jones industrial average <.DJI> gained 64.25 points, or 0.54 percent, to 11,961.52. The Standard & Poor's 500 Index <.SPX> added 2.22 points, or 0.18 percent, to 1,267.64. But the Nasdaq Composite Index <.IXIC> dropped 7.76 points, or 0.29 percent, to 2,623.70.

The S&P 500 has dropped 7 percent from its April 29 closing high.

The benchmark S&P 500 Index appeared to bounce back from a technical support test at 1,257.88, its 200-day moving average, recovering from an intraday low of 1,258.07.

Quadruple witching is a term used by pros to describe the

quarterly expiration and settlement of four types of June equity futures and options contracts -- an event that can add volume and volatility as investors adjust their derivatives positions.

The two-day event begins when June stock-index futures and certain options on the cash indexes such as the S&P 500 and the Nasdaq 100 <.NDX> stop trading at Thursday's close. These contracts then settle on Friday's morning opening.

We've got expiration -- end of the month, end of the quarter -- we've got a couple of things coming down in the pipe right here. Shuffle that with Greece, U.S. economic data, oil, we've got a little bit of a perfect storm going on, Corpina said.

We are going to continue to see volatility, we are going to continue to see volume. When you see that volume, volume adds that conviction to the market. But as we start to see higher volume, it's really going to get the snowball effect.

RESEARCH IN MOTION SLIDES LATE

Dow component American Express Co rose 2.4 percent to $48.42, helping to bolster the blue-chip average.

Among the day's upbeat company news, shares of Kroger Co , the biggest U.S. supermarket operator, jumped 4.5 percent to $23.99 after it posted a higher-than-expected quarterly profit that was helped by cost controls and a rise in sales. Kroger also boosted its full-year profit forecast.

After the closing bell, U.S.-listed shares of Research in Motion plunged as much as 15 percent after the Canadian company reported its quarterly profit dropped and revenue missed its lowered forecast, forcing the BlackBerry maker to slash its outlook.

The day's data painted a mixed picture of the economy.

Factory activity in the U.S. Mid-Atlantic region unexpectedly shrank in June, another sign of weakness in the manufacturing sector, according to the June reading of the Philadelphia Federal Reserve Bank's business activity index.

Another report on Thursday showed the number of Americans signing up for jobless benefits fell last week, while housing starts and building permits rose in May.

Volume was modestly active with about 7.78 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq, slightly above the daily average of 7.58 billion.

Declining stocks outnumbered advancing ones on the NYSE by 1,660 to 1,355. In contrast, on the Nasdaq, the opposite trend prevailed, with advancers beating decliners 1,332 to 1,254.

(Reporting by Chuck Mikolajczak; Editing by Jan Paschal)