NEW YORK (TheStreet) -- The S&P 500 was on track to close at record highs by the final hour of trading Thursday as a rally in the energy sector boosted the benchmark index.

The S&P 500 was up 0.29% to 2,131.9, above its May 18 record of 2,129. The Dow Jones Industrial Average rose 0.11%, and the Nasdaq added 0.4%. 

Crude oil added to Wednesday's gains 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 more than 1% 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 3.7% 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 1%.

U.S. manufacturing activity slowed in May, according to Markit's manufacturing purchasing index. The headline reading of 53.8 was down from 54.1 in April, while new orders growth slowed to its slowest pace since January 2014.

"The May flash PMI is consistent with our expectation that the domestic manufacturing sector will continue to face headwinds from the lagged effects of stronger dollar and lower energy prices," said Barclays analyst Jesse Hurwitz in a note.

Existing U.S. home sales fell 3.3% in April to an adjusted annual rate of 5.04 million, falling back from March highs as prices rose, according to the National Association of Realtors. Economists had expected an April rate of 5.24 million.

The Philadelphia Fed Business Outlook fell to a reading of 6.7 in May from 7.5 a month earlier. Economists had expected the measure to tick up to 8.

Fed minutes from the central bank's April meeting were released on Wednesday and showed that many on the Fed board saw a June rate hike as unlikely, with only a few members supporting an increase next month.

Initial jobless claims for the week ended May 15 climbed 10,000 to a four-week high of 274,000. Economists had expected claims to climb to 269,000. The measure, however, remained near 15-year lows.

McDonald's (MCD) shares were pressuring the Dow as protesters demonstrated outside of the corporate offices in Illinois at the company's annual shareholder meeting on Thursday. The protesters are calling for the fast food chain to raise wages to $15 an hour.

Amazon (AMZN) climbed more than 2% on news it will begin to offer one-hour delivery from local stores in Manhattan to Amazon Prime Now customers. The online retailer also received a price target boost from Morgan Stanley. Click here for more.

Best Buy (BBY) surged more than 5% after earning 37 cents a share in its recent quarter, above forecasts of 29 cents. Revenue of $8.56 exceeded estimates of $8.46 billion.

Salesforce.com (CRM) was also moving higher after posting quarterly net income of 16 cents a share, well above estimates of 2 cents. Revenue climbed 23% to $1.51 billion, only slightly higher than forecasts.

CVS (CVS) was on the move after confirming it will buy Omnicare (OCR) for $98 a share or $12.7 billion. The purchase is expected to close by the end of the year.

Lumber Liquidators (LL) plummeted 14% after CEO Robert Lynch resigned. Founder Thomas Sullivan will assume the CEO position. The company has been in strife for months since a 60 Minutes report accused the company of unsafe flooring products.

Airline stocks were moving higher, recovering from two days of losses. The sector was shaky after Southwest Airlines (LUV) said it would increase capacity, fueling concerns carrier growth could outpace travel demand. Click here to read more.

Southwest is one of the top 10 companies in the S&P 500 expected to have the biggest earnings growth this year, according to S&P Capital IQ. Click here to read more.

Hewlett-Packard (HPQ), Aeropostale (ARO), Gap (GPS), and Lions Gate Entertainment (LGF) are scheduled to report earnings after the bell.

HP said Thursday it plans to sell a majority stake in its China data networking business to a subsidiary of Tsinghua Holdings. Click here to read more.

More from Markets

P&G, GE and IBM Need to Innovate; Has Starbucks' Stock Grown Ice Cold?--ICYMI

P&G, GE and IBM Need to Innovate; Has Starbucks' Stock Grown Ice Cold?--ICYMI

Is Best Buy Sleeping With the Enemy With Amazon Partnership?

Is Best Buy Sleeping With the Enemy With Amazon Partnership?

Sprint, T-Mobile Might Have to Do More Than Make Promises to Get Deal Approved

Sprint, T-Mobile Might Have to Do More Than Make Promises to Get Deal Approved

Video: The S&P 500 Is Failing to Make New Highs

Video: The S&P 500 Is Failing to Make New Highs

Dow, S&P 500 and Nasdaq Finish Lower as Apple, P&G Slump

Dow, S&P 500 and Nasdaq Finish Lower as Apple, P&G Slump