Wall Street was little changed on Thursday, erasing earlier gains as lackluster May retail sales offset data reinforcing optimism that tomorrow's payroll report would be strong.

The S&P retail index <.RLX> was up 0.2 percent, off session higher as May U.S. retail sales rose 2.5 percent on average, below expectations for 2.6 percent growth.

Costco Wholesale Corp fell 1.9 percent to $57.84 after its sales missed estimates, while BJ's Wholesale Club Inc lost 2.8 percent to $36.68. On the upside, Bon-Ton Stores Inc gained 3.8 percent to $12.58.

The retail sales reflect what we're likely to see out of the consumer for a while: growth, but not robust growth, said Paul Kasriel, director of economic research at Northern Trust in Chicago.

The Dow Jones industrial average <.DJI> was up 2.27 points, or 0.02 percent, at 10,251.81. The Standard & Poor's 500 Index <.SPX> rose 0.08 points, or 0.01 percent, at 1,098.46. The Nasdaq Composite Index <.IXIC> added 3.93 points, or 0.17 percent, at 2,285.00.

The market cut gains from earlier in the session after reports showed the Institute for Supply Management's services index grew for a fifth straight month, while private employers added jobs in May, and initial jobless claims fell.

In other economic data, new orders received by U.S. factories rose 1.2 percent in April, the government said. Analysts expected an increase of 1.8 percent.

The data is mixed at best, said Dan Cook, senior market analyst at IG Markets in Chicago. However, the numbers are close enough to consensus that there's still quite a bit of optimism for tomorrow's number.

On Friday, the critical May non-farm payrolls report is due, with economists looking for 513,000 non-farm jobs being added to the economy.

JPMorgan Chase & Co fell 0.5 percent to $39.37. The big bank, a Dow component, was fined a record 33.32 million pounds ($49.12 million) in Britain for failing to adequately protect client money.

(Editing by Jeffrey Benkoe)