NEW YORK -- The stock market held close to its all-time high on Thursday amid optimism that the economy is set to strengthen.

Stocks are on course for their best weekly gain in seven weeks after investors got more encouraging news on the economy. A survey showed that U.S. service firms increased their business more quickly last month as new orders rose. Separate reports earlier in the week had shown manufacturing strengthening, hiring picking up, and sales of cars and trucks rising.

The news came ahead of the government’s monthly jobs report, which will be published Friday. Investors expect to see a strong pickup in hiring. Economists are forecasting that the U.S. economy added 200,000 jobs in March, according to FactSet. That would be the biggest gain in hiring since November.

"If you have a decent economy, a modestly growing economy, that’s supportive of corporate earnings and stocks can continue to benefit from that," said John Fox, director of research at Fenimore Asset Management.

The Standard & Poor’s 500 index fell 2.13 points, or 0.1 percent, to 1,888.77. The index closed at an all-time high of 1,890 a day earlier after rising for four straight days. The Dow Jones industrial average fell 0.45 point, or less than 0.1 percent, to 16,572.55. The Nasdaq composite fell 38.72 points, or 0.9 percent, to 4,237.74.

Stocks started the day higher after getting a lift from a report on the U.S. service sector, a broad category of businesses thank includes banks, transportation and construction.

The Institute for Supply Management’s non-manufacturing index rose to 53.1 in March, up from 51.6 in February, indicating that growth in the service sector is picking up. The survey also showed hiring picking up.

However, by midmorning stocks started to drift lower. Investors seemed unwilling to place big bets on the market before Friday’s key jobs report.

"Going into the employment report, a lot of people aren’t anxious to open new positions," said J.J. Kinahan, chief strategist with TD Ameritrade. "They don’t want to be taken by surprise."

Barnes & Noble was among the day’s big losers.

The stock fell $2.99, or 13.5 percent, to $19.12 after Liberty Media said it was cutting its stake in the company. Liberty Media, the investment company controlled by billionaire John Malone, gave Barnes & Noble a lifeline in 2011 when it bought a 17 percent stake in the company.