Wall Street closed slightly higher on Thursday as fresh data gave a rosier view of the economy and further gains for healthcare shares countered declines in energy names.

The S&P 500 ended at its highest closing level in seven months, while the Nasdaq minted its seventh straight day of gains.

Investors now await Friday's payrolls report as they evaluate economic data to determine whether the Federal Reserve will hike interest rates as soon as its June 14-15 meeting.

Data on Thursday showed U.S. private employers increased hiring in May and new applications for jobless benefits fell last week, further boosting the economic outlook for the second quarter.

"The issue for the market for really the last several weeks has been whether there is enough top-line growth at companies and growth in the economy to support what looks like a higher interest rate from the Fed," said Rick Meckler, president of LibertyView Capital Management in Jersey City, New Jersey.

"Numbers today made people a little more confident," Meckler said.

The Dow Jones industrial average rose 48.89 points, or 0.27 percent, to 17,838.56, the S&P 500gained 5.93 points, or 0.28 percent, to 2,105.26 and the Nasdaq Composite added 19.11 points, or 0.39 percent, to 4,971.36.

The S&P 500 is up 3 percent in 2016 after a gloomy start to the year amid jitters about the global economy and a volatile oil market. It now only needs to rise about 1 percent to set a closing record, which would be its first in more than a year.

On Thursday, the healthcare sector gained 1.3 percent, making it the best-performing group and tallying its seventh straight day of gains. Johnson & Johnson added 1.5 percent after saying it would acquire hair care products maker Vogue International for $3.3 billion.

After a rough start for 2016, healthcare has rebounded 5 percent since mid-May and is now in positive territory for 2016.

Seven of 10 sectors ended higher. Energy shares were the worst performers, falling 0.3 percent.

Joy Global surged 21.9 percent after the mining equipment maker reported a surprise adjusted quarterly profit. Larger rival Caterpillar rose 1.9 percent.

Apple shares fell 0.8 percent as Goldman Sachs analysts cut their price target on the iPhone maker, citing lower growth expectations for the smartphone industry.

About 6.4 billion shares changed hands on U.S. exchanges, below the roughly 7 billion daily average for the past 20 trading days, according to Thomson Reuters data.

NYSE advancing issues outnumbered decliners 1,960 to 1,039, for a 1.89-to-1 ratio on the upside; on the Nasdaq, 1,750 issues rose and 1,075 fell for a 1.63-to-1 ratio favoring advancers.

The S&P 500 posted 36 new 52-week highs and 1 new low; the Nasdaq recorded 81 new highs and 17 new lows.