NEW YORK (TheStreet) -- The S&P 500 celebrated a new record close on Thursday, climbing slightly after higher crude prices fueled a rally in the energy sector.

The S&P 500 was up 0.23% to 2,130.8, above its May 18 record of 2,129. The Dow Jones Industrial Average was flat, and the Nasdaq added 0.38%.

Crude oil notched its best gains in a month as commodity traders bet the latest weak data out from China would encourage the People's Bank of China to introduce further monetary stimulus. The HSBC China Manufacturing Purchasing Managers Index increased to 49.1 in May, up from 48.9 in April though it remained under 50 which signals contraction.

Also boosting commodity markets, the Energy Information Administration reported Wednesday a fall of 2.7 million barrels in crude supplies for the week ended May 15. Analysts had expected a drop of 2 million barrels. West Texas Intermediate added closed 3% higher to $60.72 a barrel.

BP (BP) was 2% higher after settling with Halliburton (HAL) and Transocean (RIG) over claims related to the 2010 Gulf of Mexico oil spill. Transocean will get $125 million compensation for legal claims, though will have to pay nearly double that into a fund compensating victims of the spill. Transocean gained 4.3% while Halliburton climbed 2.7%.

Other winners in the energy sector included Chevron (CVX), Schlumberger (SLB), and Petrobras (PBR). The Energy Select Sector SPDR ETF (XLE) added 0.93%.

If you liked this article you might like

Roku, Nucana and Other IPOs That Should Be on Your Radar in 2017

Time to Play Equifax?

Energy M&A Weekly: More Midstream IPOs Expected in 2017

Time to Play Equifax?

Here's Where Wall Street Stands