Stocks rose on Thursday, led by a late-day surge in technology shares as investors geared up for a strong unemployment report on Friday.

Stocks seesawed throughout the session, shifting between optimism and pessimism on a variety of factors, including technical resistance at the S&P 200-day moving average, the euro's weakness, and supportive labor market data.

Technology shares, among the biggest beneficiaries of an economic recovery, led the rally, with the Philadelphia semiconductor index <.SOXX> up 1.2 percent. Microsoft Corp rose 1.5 percent to $26.86 after Chief Executive Steve Ballmer said the company will continue to prosper even as the transition from PCs to other devices poses a potential tumult.

This is the high beta stuff, so when the market has a decent tone to it, you'll see technology outperform on the upside, said Bill Strazullo, chief market strategist at Bell Curve Trading in Boston, referring to a stock's likelihood to swing with the market.

When we have a day where the data is good and people are more optimistic about the idea that the recovery's intact and businesses are going to spend on technology, that is the theme that dominates.

Volume was light ahead of Friday's nonfarm payrolls report, which is expected to show the economy added 513,000 jobs in May. Most of the gains are expected to be due to temporary Census hiring, which has resulted in forecasts ranging from 175,00 to 750,000 for tomorrow's figure, according to a Reuters poll.

It's just too big of a wild card, Strazullo said.

You've got a very important number coming out tomorrow with a very large range of possible outcomes and people just don't want to go into that with any unnecessary exposure.

The Dow Jones industrial average <.DJI> edged up 5.74 points, or 0.06 percent, to end at 10,255.28. The Standard & Poor's 500 Index <.SPX> added 4.45 points, or 0.41 percent, to 1,102.83. The Nasdaq Composite Index <.IXIC> rose 21.96 points, or 0.96 percent, to 2,303.03.

The S&P 500 bumped up against its 200-day moving average and failed to break through -- the third time it has done so in the last five sessions, according to Bespoke Investment Group. A break through that 1,106.26 level would be a bullish signal.

SOME RETAILERS' SALES FALL SHORT

Lackluster same-store retail sales for May had earlier pressured the market. Costco Wholesale Corp fell 1.7 percent to $57.93 after its sales missed estimates, while BJ's Wholesale Club Inc lost 2.6 percent to $38.77.

But the S&P retail index <.RLX> edged up 0.1 percent.

In a data-heavy morning, investors got a picture of the job market ahead of Friday's more comprehensive report. Data showed private employers added jobs in May and initial jobless claims fell last week.

In other data, the services sector grew for a fifth straight month in May, according to the Institute for Supply Management, and the federal government reported that new orders received by U.S. factories rose in April.

About 8.94 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, below last year's estimated daily average of 9.65 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of nearly 2 to 1, while on the Nasdaq, eight stocks rose for every five that fell.

(Reporting by Leah Schnurr; Editing by Jan Paschal)