U.S. stocks edged up on Thursday, erasing early losses as investors brushed off disappointing economic data and bet on a further rally in equities.

The gains came after major indexes hit multi-year highs in the previous session. The enthusiasm in the market had pushed the Nasdaq to a 10-year high, and the Dow is now up 10 percent and the S&P 500 up 8 percent for the year.

Stocks were pressured at the open after a report showed new U.S. claims for unemployment benefits surprisingly rose last week to their highest level since January.

Separate data showed U.S. economic growth slowed more than forecast in the first three months of the year as higher food and gasoline prices dampened consumer spending and sent a broad measure of inflation rising at its fastest pace in 2-1/2 years.

Investors are willing to look through the GDP data because most of the weakness was beyond the consumer... If you really just look at the organic power of the consumer, for the most part it is remarkable to me that spending is as strong as it is in the face of $4 gasoline prices, said Jack Ablin, chief investment officer at Harris Private Bank in Chicago.

The Dow Jones industrial average <.DJI> was up 38.79 points, or 0.31 percent, at 12,729.75. The Standard & Poor's 500 Index <.SPX> was up 2.33 points, or 0.17 percent, at 1,357.99. The Nasdaq Composite Index <.IXIC> was down 1.44 points, or 0.05 percent, at 2,868.44.

The Nasdaq jumped to a 10-year high on Wednesday as Wall Street rallied on the prospect of continued low interest rates and liquidity until the end of June.

Earnings season has been strong, but there were signs of creeping costs from some companies. Procter & Gamble Co

lowered the high end of its profit forecast as it trimmed expenses and increased prices to offset rising materials costs. Its shares fell 0.5 percent to $65.22.

These consumer products (companies) are bearing most of the brunt from the higher commodity prices, because not only are commodities in general hurting costs, but high energy, in particular gasoline, is crimping demand as their consumers are forced to economize, Ablin said.

Rising costs were also in evidence at Starbucks Corp . The company warned on Wednesday that costs will take a bigger chunk out of earnings than previously anticipated, and its full-year forecast disappointed Wall Street. The shares fell 0.5 percent to $36.98.

Other economic data showed pending sales of existing U.S. homes were much stronger than expected in March, offering faint glimmers of hope for the depressed U.S. housing market.

Home builder Pulte Group Inc

reported a smaller-than-expected quarterly loss, and its shares rose 4.2 percent to $8.32.

(Editing by Padraic Cassidy)