Stocks gained on Thursday, bouncing back after three days of declines as investors searched for bargains, but the near-term outlook is bearish as Japan's crisis keeps investors cautious.

All three major U.S. stock indexes recovered from Wednesday's lows, which had put both the benchmark S&P 500 and the Nasdaq in negative territory for the year.

The S&P 500 climbed back into the black for 2011 with Thursday's gain. But the Nasdaq could not hold on to its morning move back into positive territory. By early afternoon, the Nasdaq was negative again for the year.

The CBOE Volatility Index, or VIX <.VIX>, fell as stocks rose. It was down 9.3 percent after rising sharply this week.

Trading volume, which was the highest of the year on Wednesday, was at 4.3 billion, roughly average for trading at this point in the session.

While the day's bounce relieved some worries about the market's recent slide, it did not change the view of some analysts that a correction is under way.

From a chart standpoint, I don't see anything right now that suggests that the near-term decline is over, said Chris Burba, short-term market technician at Standard & Poor's in New York.

Momentum is still weakening ... I don't think the fear is going to be expelled, alleviated all at once, It's going to take some time for optimism to build back up again.

He sees 1,177-1,217 as the downside target range for the near term on the S&P 500.

The recent declines followed a rally of nearly six months in stocks. That rally in itself has prompted calls for a market correction.

On Thursday, natural resource stocks helped lead the market as commodity prices rebounded. Tensions in the Middle East and North Africa drove oil prices up sharply. Brent crude for May delivery gained $3.82 to $114.42 a barrel.

Cliffs Natural Resources Inc rose 5 percent to $87.89, while Chevron Corp gained 1.9 percent to $101.45.

The S&P energy index <.GSPE> shot up 2.3 percent, leading gains in the S&P 500, even though the prospect of higher fuel costs in general have hurt stock investor enthusiasm in recent weeks.

The Dow Jones industrial average <.DJI> was up 113.04 points, or 0.97 percent, at 11,726.34. The Standard & Poor's 500 Index <.SPX> was up 12.61 points, or 1.00 percent, at 1,269.49. The Nasdaq Composite Index <.IXIC> was up 23.68 points, or 0.90 percent, at 2,640.45.

A correction at this point could be short-lived, some analysis suggests.

Cleveland Rueckert, an analyst at Birinyi Associates Inc. in Stamford, Connecticut, said in a note: Since 1945, 5 percent declines that occur during a broader rally last an average of 41 days and decline 8.29 percent.

If the averages hold, the S&P 500 will bottom at 1,232 on March 31, Rueckert wrote.

Economic bellwether FedEx Corp , the world's largest cargo airline, forecast improved revenue, boosted by strong demand. The stock rose 4.1 percent to $88.76 and helped lift the shares of United Parcel Service Inc , the largest package delivery company. UPS stock gained 1.5 percent to $71.44.

(Reporting by Caroline Valetkevitch; Additional reporting by Doris Frankel; Editing by Jan Paschal)