Major stock indexes closed with gains Thursday as investors welcomed economic news on jobs and factory orders. The market is coming off two days of losses.

At the close Wall Street, the Dow Jones industrial average was up 65.1 points, about 0.4 percent, to 17,763.2. The Standard & Poor's 500 index added 7.3 points, about 0.4 percent, to nearly 2,067. The Nasdaq composite gained 6.7 points, about 0.1 percent, to nearly 4,887.

As the markets closed, benchmark U.S. crude was down at midday 62 cents at $49.48 a barrel on the New York Mercantile Exchange.

The markets are closed Friday for religious observances, but investors are preparing for the start of quarterly reports next week.

THE QUOTE: Weekly initial unemployment benefit claims were better than expected, and the four-week trend continues to go in the right direction, said analyst Tim Dreiling, senior portfolio manager at U.S. Bank Wealth Management.

"This is perhaps reversing some of yesterday's pessimism, trying to trade on the better initial claims news, because we won't be trading on it tomorrow when we get payrolls," he said, referring to the government's monthly nonfarm payroll figures.

That report is due out Friday, when markets will be closed for the Good Friday holiday.

advertisement | advertise on newsday

BACK TO WORK: The Labor Department said applications for unemployment benefits fell sharply last week to a seasonally adjusted 268,000. The decrease is a sign of a strong job market despite evidence of tepid economic growth in the opening months of 2015.

TAKING ORDERS: New data on U.S. factory orders also helped lift the market. The Commerce Department said orders edged up 0.2 percent in February, breaking a six-month losing streak. Excluding volatile transportation orders, factory orders rose 0.8 percent, the most since June.

MIND THE GAP: The Commerce Department said that the nation's trade deficit plummeted 16.9 percent to $35.4 billion in February. The trade gap fell as imports and exports sank, driven by a since-settled trade dispute and a global economic slowdown that has cut into oil prices and caused the dollar to rise in value.

EARNINGS AHEAD: Investors have been weighing mixed economic data this week in advance of the next round of corporate earnings, which begins next week. On Tuesday, they got a dash of encouraging data on consumer confidence, spending and home prices. But Wednesday's reports clouded the economic picture.

SECTOR WATCH: The 10 sectors in the S&P 500 rose, led by telecommunications services stocks.

DRIVING PROFITS: CarMax climbed 9.4 percent after the dealership operator said that its profit rose sharply in the latest quarter as purchases of used vehicles increased. The stock climbed the most out of all the stocks in the S&P 500 index, adding $6.42 to $74.82.

SALES UPDATE: Rite Aid surged 5.5 percent after the drugstore operator reported increased sales at stores open at least a year in March. That's a key barometer of sales for retailers. The stock gained 47 cents to $9.04.

HORMONE BOOST: Shares in Repros Therapeutics jumped 9.4 percent after the company said that the Food and Drug Administration accepted its application seeking approval for a testosterone drug. Repros added 80 cents to $9.29.