Stocks rose slightly on Wednesday with the S&P 500 hovering near an all-time high.
The benchmark gained 0.14% to 4,208.12 on Wednesday, sitting about 0.7% from its record hit in May. The Dow Jones Industrial Average added 25 points to close at 34,600.38. The technology-heavy Nasdaq Composite rose 0.14% to 13,756.33.
All three indexes are fairly close to record levels. The Dow and Nasdaq are 1.4% and 3.2% below their respective records.
Energy stocks again outperformed the broader market on Wednesday as crude prices continued their recent rebound. Investors have snapped up shares of some of the nation's largest oil and gas companies in recent sessions as optimism about the economic rebound in the U.S. fosters demand for crude, airfare and other travel-related assets.
Those equity moves came as West Texas Intermediate oil futures rose 1.57% to $71.35 a barrel, pushing even higher after the contracts settled at their highest level since 2018 on Tuesday.
AMC shares, popular among retail investors and often subject to trading mania, soared 95% and was briefly halted for volatility. The meme stock was up 22% on Tuesday after raising $230.5 million through a stock sale.
Some key tech stocks were lower, weighing on the market. Zoom Video shares fell about 0.2% despite the company reporting blowout earnings on Tuesday. Sales grew 191% in the first quarter. Tesla and Microsoft also closed lower.
Markets may be on hold before the big jobs report on Friday. The U.S. likely added 671,000 nonfarm payrolls in May, up from 266,000 jobs added in the previous month, according to economists polled by Dow Jones.
Inflation fears, and the ways in which the Federal Reserve might respond, have weighed on sentiment recently, although the major averages are still hovering around all-time highs.
"Inflation expectations have also increased beyond what may be achievable in the near term. Inflation is on the upswing in our view and will eventually surpass the Fed's targets on a sustainable basis," Morgan Stanley chief U.S. equity strategist Mike Wilson told clients. "However, expectations have increased too and now price this rise in many asset markets."
On Tuesday, the Dow gained 46 points, after rising more than 300 points at one point. The S&P broke a 3-day win streak to close down just 2 points, after shooting to within 4 points of its all-time high of 4,238. The Nasdaq Composite shed 0.09%.
Become a smarter investor with CNBC Pro.
Get stock picks, analyst calls, exclusive interviews and access to CNBC TV.
Sign up to start a free trial today
— with reporting from CNBC's Patti Domm.