Energy shares helped the Dow and S&P 500 end a three-day losing streak on Tuesday, even as investors worried rising fuel costs will undercut economic growth.
Earnings reports from smaller companies, including homebuilder Lennar and store chain Sears Holdings, also supported stocks, but volume was low for a second day, raising questions about the sustainability of the longer term rally.
The S&P Energy sector rose 1.2 percent on a 2 percent rally in the price of oil, but transportation and consumer stocks weakened on worries about higher energy costs.
There's a big feeling we're going to have $100 barrel oil pretty quickly, said Shawn Hackett, president at Hackett Advisors in Boynton Beach, Florida.
He said that is clearly bullish for the sector, but oil above $90 a barrel could take disposable income away from the economy and could hurt demand.
Sears Holdings Corp
The Dow Jones industrial average <.DJI> gained 34.43 points, or 0.30 percent, to 11,671.88. The Standard & Poor's 500 Index <.SPX> added 4.73 points, or 0.37 percent, to 1,274.48. The Nasdaq Composite Index <.IXIC> rose 9.03 points, or 0.33 percent, to 2,716.83.
Stocks had rallied previously on optimism about profits, but the Dow and S&P 500 ended down the past three sessions.
Short-term technical resistance for the benchmark S&P is seen around 1,280 while the area between 1,265 and 1,260 provides support.
About 7.2 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, below last year's estimated daily average of 8.47 billion.
Advancing stocks outnumbered declining ones on the NYSE by 1,756 to 1,213, while on the Nasdaq, more than five stocks rose for every three that fell.
Verizon Communications Inc
Women's clothier Talbots Inc
(Reporting by Rodrigo Campos; Editing by Kenneth Barry)