Stocks rose slightly on Tuesday, rebounding from weeks of selling, but initial gains were mostly erased by afternoon as retail shares weighed.

Wall Street started the day strongly, with the Nasdaq gaining more than 2 percent and the S&P 500 bouncing back from a 10-month closing low on Friday.

A lot of people got excited about how cheap things have gotten, said Stephen Massocca, managing director of Wedbush Morgan in San Francisco.

But the market sentiment is still bearish, and nobody believed that the dead cat bounce we saw this morning would last.

The Dow Jones industrial average <.DJI> was up 29.29 points, or 0.30 percent, at 9,715.77. The Standard & Poor's 500 Index <.SPX> was up 3.15 points, or 0.31 percent, at 1,025.73. The Nasdaq Composite Index <.IXIC> was up 3.01 points, or 0.14 percent, at 2,094.80.

Retailers were the top decliners after Citigroup cut targets on retail stock prices, including Home Deport , Macy's Inc and JC Penney Co .

Home Depot fell 1.5 percent to $27.32 and Macy's fell 2.2 percent to $17.45. JC Penney shares were off 3 percent at $20.52.

Early gains came after data that showed the services sector, the economy's largest, grew for a sixth straight month in June.

You got a relief rally overseas that set up the S&P (bounce) this morning, said Joseph Battipaglia, market strategist at Stifel Nicolaus in Yardley, Pennsylvania. But he said after the services data volume disappeared on the upside, the market started to slip back.

But the data showed growth rate in services slowed to the lowest pace since February.

Battipaglia enumerated the negative implications of the growth slowdown. You don't knock down the unemployment rate, the credit problems in the private sector do not alleviate quickly and you jeopardize the modest recovery in housing.

British oil company BP ruled out a share issue amid talk of sovereign wealth fund interest in a stake, boosting its shares even as the Gulf of Mexico oil slick spread to the Texas coast.

BP's New York-traded stock gained 6.5 percent to $31.25.

(Reporting by Angela Moon, Additional Reporting by Rodrigo Campos, Editing by Kenneth Barry)