U.S. stocks rose on Thursday, helped by optimism about earnings and investors buying the quarter's high performers, while the S&P 500's push above a key level could signal further gains.

The S&P 500 broke above its 50-day moving average at 1,305, and analysts said the market may have gotten past the worst of its recent pullback.

What I saw yesterday and today is a stabilization of the market, said Bruce Zaro, chief technical strategist at Delta Global Asset Management in Boston.

There have been a few good earnings reports that have given investors a bit more confidence that earnings are likely to hold ... so the story will continue that the rally has been built on strong earnings momentum, he said.

The S&P 500 is up 24 percent since the start of September but briefly dipped into negative territory for the year recently amid worries about high oil prices and the disaster in Japan.

The S&P 500 consumer discretionary index <.GSPD> was up 1.5 percent after electronics retailer Best Buy reported better-than-expected earnings on strong smartphone sales. Best Buy's stock, was down 2.9 percent at $30.93, reversing earlier gains that took it as high as $32.98.

Oracle , due to report after the close, gained 1.5 percent to $31.88 and supported the Nasdaq, which was up more than 1 percent.

The Dow Jones industrial average <.DJI> was up 89.34 points, or 0.74 percent, at 12,175.37. The Standard & Poor's 500 Index <.SPX> was up 10.96 points, or 0.84 percent, at 1,308.50. The Nasdaq Composite Index <.IXIC> was up 34.31 points, or 1.27 percent, at 2,732.61.

With the market near the end of the quarter, portfolio managers will buy equities as they execute window dressing, and hedge funds will cover short positions that are under pressure.

The S&P energy index <.GSPE> is among leading sectors for the quarter, with gains so far of 13.5 percent. The index was up 0.3 percent on Thursday.

A semiconductor index <.SOX> was up 2.5 percent.

Options investors, meanwhile, placed more defensive bets on the market.

S&P 100 index <.OEX> traders were looking for a correction, though, as the put/call ratio surged near a five-year high on Wednesday, according to Jason Goepfert, president of sentimentrader.com.

Even during the past six months, such spikes in that ratio have led to more short-term weakness than strength, he said.

Red Hat Inc surged 17,1 percent to $46.82 after a brokerage upgraded the stock. The company's earnings topped estimates late Wednesday.

Earnings growth is expected to help the market overcome worries about unrest in the Middle East and North Africa and Japan's crisis this year. The S&P 500 was forecast to end the year 11 percent higher, according to a Reuters poll released on Thursday.

(Reporting by Caroline Valetkevitch; Additional reporting by Doris Frankel in Chicago and Angela Moon in New York; Editing by Jan Paschal.