Stocks edged higher late in a choppy, thinly traded session on Thursday as investors built on momentum gained after the S&P 500 index broke through its 200-day moving average earlier this week.

Buying in defensive stocks, such as utilities and consumer staples like Procter & Gamble and FirstEnergy Corp , helped lift indexes just before the close.

I don't think that the buyers are willing to give up on the market just yet. We still have quite a bit of momentum, said Peter Kenny, managing director at Knight Equity Markets in Jersey City, New Jersey. Even though we get these intraday sell-offs, they're met with a pretty well bid market.

The Dow Jones industrial average <.DJI> gained 24.71 points, or 0.24 percent, to 10,434.17. The Standard & Poor's 500 Index <.SPX> added 1.43 points, or 0.13 percent, to 1,116.04. The Nasdaq Composite Index <.IXIC> inched up 1.23 points, or 0.05 percent, to 2,307.16.

The S&P 500 moved above its 200-day moving average for the first time in a month on Tuesday. Some investors see that as a bullish momentum signal.

That is helping prop the market up. The question is if it does stay above that 200-day, does that help it go even higher, said Tim Ghriskey, chief investment officer of Solaris Asset Management in Bedford Hills, New York.

Underscoring the market's cautious nature, defensive shares rose. Procter & Gamble was up 0.9 percent to $61.76, while the S&P consumer staples index <.GSPS> rose 0.7 percent. Electric utility FirstEnergy advanced 1.6 percent to $38.54.

INDEXES LOWER ON DATA

Stocks traded down most of the day as weak reports on manufacturing and jobless claims underscored worries about the pace of the economic recovery. One trader pointed to short covering as another factor lifting the market into the close.

The volume was very, very low, said Stephen Massocca, managing director of Wedbush Morgan in San Francisco. The positive finish was largely short-term traders covering short term positions in a very quiet market.

Traders cover short positions, or bets the market will fall, by buying back stocks they have borrowed and sold.

As well as the low volume, volatility was aggravated by options and futures expirations on Friday.

The quadruple witching period, as it is called, refers to the quarterly settlement and expiration of four different types of June equity futures and options contracts.

It was a scramble as traders adjusted their positions into expiration in the last minute of trade for the June futures, said Frank Lesh, a futures analyst and broker at FuturePath Trading LLC in Chicago.

Helping the Nasdaq, Apple Inc touched a lifetime high at $272.90 a day after the company said it sold more than 600,000 units of its new iPhone. Its shares ended up 1.7 percent at $271.87.

Cleveland Rueckert, an analyst at Birinyi Associates, said the stock, which trades around 20 times estimated earnings still looks cheap when factoring in an 18 percent long-term annual growth rate over the next five years.

Rueckert said a common metric is to see a stock as good value at a price to earnings ratio that is up to double the long term growth rate. For Apple that would be 36.

There were some signs of recovery in companies involved in the Gulf of Mexico oil spill, even as BP CEO Tony Hayward was grilled in front of a congressional committee on the Gulf of Mexico spill. U.S.-traded BP shares fell 0.4 percent to $31.71.

By contrast, U.S.-traded shares of Transocean , the oil rig operator for BP, rose 5.1 percent to $49.43 and closed above their 14-day moving average for the first time since April 26.

About 7.94 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, well below last year's estimated daily average of 9.65 billion.

Declining stocks just outnumbered advancing ones on the NYSE while that trend was reversed on Nasdaq.

(Reporting by Edward Krudy; Additional reporting Chuck Mikolajczak and Matthew Lynley; Editing by Kenneth Barry)