U.S. stocks extended gains on Thursday after trade data showed record U.S. exports, easing concerns about a stalled economic recovery following a six-day slide that left the equities market oversold.

Various economists said the spike in exports in April could prompt upward revisions of gross domestic product growth in the second quarter.

You're seeing exports picking up pretty dramatically, a positive data point, and a market that had gone down six days in a row, said Eric Kuby, chief investment officer of North Star Investment Management Corp in Chicago, in reference to the report showing narrower U.S. trade deficit for April.

You finally have a day with a reason for people to start buying stocks again. The appetite has come back.

The S&P 500 fell the last six days and was down more than 6 percent from a peak in early May, while the Nasdaq Composite had nearly erased its gains for the year so far.

For a while, people have been waiting for an entry point, Kuby said. Some market participants are saying, 'We've got this pullback. Let's get invested.'

The link to the Japanese earthquake in the trade data, which showed a drop in imports from Japan, also backs up widespread opinion that the economy's recent soft patch is only temporary and not pointing to a dip back into recession in the United States.

S&P sectors most linked to a growing economy led the market higher, with a materials index <.GSPM> up 2.1 percent and an energy index <.GSPE> up 1.3 percent. The Morgan Stanley cyclical index <.CYC>, which is down more than 5 percent in June, rose 1.2 percent on Thursday.

The Dow Jones industrial average <.DJI> gained 118.63 points, or 0.98 percent, to 12,167.57. The Standard & Poor's 500 Index <.SPX> added 12.64 points, or 0.99 percent, to 1,292.20. The Nasdaq Composite Index <.IXIC> rose 15.41 points, or 0.58 percent, to 2,690.79.

The mood remained fragile despite the rebound, with some analysts still expecting the S&P 500 to retest its March low after a string of data, including the latest payrolls report, provided little room for optimism.

A test of 1,250 is pretty likely in the next couple of weeks, said John Canally, an investment strategist and economist for LPL Financial in Boston. We do think it's going to hold, unless we get another round of bad news from Europe. Data from May is going to look weak, but earnings estimates are still relatively unchanged.

The PHLX semiconductor index <.SOX> bounced off its 200-day moving average and was holding above 410, a key level that gave strong support in March. It was up 0.6 percent on Thursday.

It's telling you that these supply-chain disruptions in Japan may be ebbing, and once that happens, business can tick up again, LPL's Canally said. Demand is still out there. Consumers just couldn't get what they wanted.

Texas Instruments Inc shares rose 1 percent to $32.99 even after the company cut its earnings and revenue forecasts late on Wednesday. The company blamed the shortfall on major client Nokia's ailing cellphone business.

Reflecting the appetite for tech stocks, shares of Fusion-io surged 21.6 percent to $23.10 in their first day of trading -- up from an initial public offering price of $19. Earlier, the stock was up as much as 34.2 percent at a session high of $25.50. The Salt Lake City, Utah-based company makes storage memory hardware and software for data centers.

But shares of China-based Taomee Holdings Ltd fell 4.8 percent to $8.57 in their stock market debut as U.S.-listed Chinese companies come under more scrutiny following a series of accounting scandals. U.S. regulators, brokers and investors are sharpening their look at Chinese companies.

Details of Thursday's economic data showed the U.S. trade deficit narrowed unexpectedly in April as U.S. exports rose to a record and imports from Japan tumbled more than 25 percent.

A separate report showed the number of Americans filing new claims for unemployment benefits rose by 1,000 last week, while continued claims fell more than expected.

(Reporting by Rodrigo Campos; Additional reporting by Clare Baldwin; Editing by Jan Paschal)

(This story is corrected in the 10th paragraph to say the low referenced is from March 2011, not 2010)