A solid pickup in hiring last month helped push the stock market to record highs Friday. The gains were driven by energy, technology and industrial companies.

The Labor Department told investors what they had hoped to hear: employers added more workers last month after a sluggish beginning to the year.

Energy companies rose as the price of oil recovered from losses earlier in the week. Media companies like CBS and Charter Communications recovered from their losses earlier in the week. Technology companies rose, but IBM missed out after billionaire investor Warren Buffett said he sold a large part of his stake in the company.

The Standard & Poor’s 500 index finished above the all-time high close it set March 1.

Scott Wren, senior global equity strategist at Wells Fargo’s Investment Institute, said stocks benefited from the combination of greater hiring and slower wage growth because if wages rise too quickly it will affect corporate profits.

“The market is likely to be concerned about wage gains and the impact on corporate margins as we move into 2018,” he said.

The S&P 500 climbed 9.77 points, or 0.4 percent, to 2,399.29. The Dow Jones industrial average rose 55.47 points, or 0.3 percent, to 21,006.94.

advertisement | advertise on newsday

The Nasdaq composite jumped 25.42 points, or 0.4 percent, to 6,100.76, which beat a record it set earlier this week.