U.S. stocks gained on Thursday after surprisingly strong March retail sales created optimism that a consumer spending rebound would be a harbinger of strong corporate earnings.

Investors snapped up retailers' shares after top U.S. chains reported a record increase in same-store sales for March. The early Easter holiday and an improving job market last month helped retailers beat Wall Street's forecast.

Online merchant Amazon.com jumped 4.7 percent to $141.15, a 2010 intraday high for the stock. The S&P retail index <.RLX> rose 1.5 percent.

Clearly the consumer is showing that they are beginning to spend again, said David Katz, chief investment officer of Matrix Asset Advisors in New York.

Even though the consumer sentiment numbers have been underwhelming, the consumer's actual actions have been more favorable.

The indexes' moderate gains were characteristic of the most recent leg up for the rally. The S&P 500 has ground slowly higher since the beginning of March, rising 7.6 percent.

The biggest thing in the market at the moment is, the path of least resistance is higher, Katz said. You've had an improving market for the last month-and-a-half, and you have people that were underinvested that seem to be jumping on that bandwagon.

The Dow Jones industrial average <.DJI> added 42.40 points, or 0.39 percent, to 10,939.92. The Standard & Poor's 500 Index <.SPX> rose 4.84 points, or 0.41 percent, to 1,187.29. The Nasdaq Composite Index <.IXIC> gained 6.88 points, or 0.28 percent, to 2,438.05.

Gains in retailers' stocks eclipsed worries about Greece's high debt load as the country's borrowing costs rose to new highs even as the government struggled to reassure markets it can stay solvent.

An index of U.S.-listed stocks of Greek companies <.BKGR> fell 1.9 percent.

Shares of United Airlines parent UAL Corp jumped 8.6 percent to $20.58 on Nasdaq and US Airways Group surged 13.1 percent to $7.71 on the New York Stock Exchange in the wake of news that the two airlines were in merger talks.

Among advancers in the retail space, Target Corp rose 3.4 percent to $55.86, while Gap Inc climbed 3.4 percent to $24.66. Major retail chains reported a record 9.1 percent jump in March same-store sales -- beating the forecast for a 6.3 percent gain, according to Thomson Reuters data. Of the 28 retailers that Thomson Reuters tracks, more than 90 percent topped estimates.

Even so, retail executives warned that the jump in March would come at the expense of April sales.

On the economic front, data showed the number of workers filing for unemployment benefits unexpectedly rose last week. But the jump reflected volatility from the Easter holiday and did not alter the view that labor markets are recovering.

(Reporting by Leah Schnurr: Editing by Jan Paschal)