Stocks rose for a second day, erasing early losses in a volatile day on Thursday as earnings helped technology and consumer discretionary stocks after a substantial fall for equities this month.

The Nasdaq posted the biggest gains after strong earnings from NetApp Inc pushed the stock up 8.6 percent to $56.19, while shares of Microsoft Corp jumped 2.4 percent to $24.77 after a prominent investor said its chief executive should resign.

Jim Awad, managing director at Zephyr Management in New York, said the market's midday comeback in the face of weak economic data could be a positive sign for investors, who continue to fret about a potential slowdown in the economy.

It speaks to the internal strength of the market that people think the internal momentum hasn't been broken yet, he said.

The best-performing sector was consumer discretionaries, helped by Tiffany & Co , up 8.6 percent at $76.03 after the luxury retailer reported its first-quarter results and raised its outlook.

The Dow Jones industrial average <.DJI> advanced 15.51 points, or 0.13 percent, to 12,410.17. The Standard & Poor's 500 Index <.SPX> rose 4.13 points, or 0.31 percent, to 1,324.60. The Nasdaq Composite Index <.IXIC> gained 19.25 points, or 0.70 percent, to 2,780.64.

However, in a sign of rising concern about the economic outlook, Goldman Sachs cut its year-end target for the S&P 500 to 1,450 from 1,500, citing margin concerns. The lower target represents upside of almost 10 percent from current levels.

The decision by Goldman Sachs to cut its S&P 500 target, one of the highest on the Street, comes after UBS and Citigroup raised their earnings forecast for S&P 500 companies last week, but kept their targets unchanged. That indicates investors are starting to put a greater risk premium on the stock market.

It would not surprise me if you see the more optimistic forecasts coming down, said Scott Marcouiller, chief technical market strategist at Wells Fargo Advisors in St. Louis.

Initial jobless claims unexpectedly rose in the latest week and stayed at elevated levels, while U.S. gross domestic product rose at an annual rate of 1.8 percent in the first quarter, unchanged from the previous estimate and below analysts' expectations for more robust growth.

The S&P 500 has fallen around 3 percent this month due to a string of weaker-than-expected economic indicators.

Comments from Eurogroup President Jean-Claude Juncker raised doubts about an IMF disbursement of financial support to Greece in June, putting markets on edge.

Helping the Nasdaq, NetApp Inc posted better-than-expected results as more cloud computing drove demand for its data storage products. Its shares rose 8.5 percent to $56.13.

Hedge fund manager David Einhorn called for Steve Ballmer, the chief executive of Microsoft Corp , to step down. Shares of the Dow component rose 2.4 percent to $24.76.

(Editing by Jan Paschal)