By Joe Wallace and Caitlin McCabe

Major U.S. stock indexes finished Tuesday's session roughly flat after fresh data showed that U.S. manufacturing activity, while expanding, continues to be affected by rising commodities prices, materials shortages and difficulties in the labor market.

Stocks climbed after the opening bell to kick off the month of June but later pulled back and gave up their early gains. The S&P 500 ultimately lost 2.07 points, or less than 0.1% to finish at 4202.04, while the technology-focused Nasdaq Composite fell 12.26 points, or 0.1%, to 13736.48.

The Dow Jones Industrial Average ticked up 45.86 points, or 0.1%, to 34575.31, its third-highest close in history. The blue-chip index pared an earlier gain of nearly 320 points.

Investors had been growing more confident recently that rising inflation won't lead central banks to unwind stimulus measures, pushing major indexes back toward all-time highs after stuttering in earlier in May. The S&P 500 on Friday finished the month of May by notching a fourth consecutive month of gains.

"The market is relatively sanguine about the inflationary pressure building," said Brian O'Reilly, head of market strategy for Mediolanum International Funds. "It is still a liquidity-driven equity market that is brushing off any bit of bad news," he added, pointing to President Biden's $6 trillion budget plan as the potential catalyst for further gains.

Still, other headwinds weigh on stocks. Valuations for some companies look high, particularly among growth and technology stocks, while investors have become increasingly concerned about elevated commodities prices, as well as supply chain setbacks and an uneven labor market recovery.

On Tuesday, the Institute for Supply Management said its purchasing-managers index of manufacturing activity picked up in May, registering at 61.2, versus 60.7 in April. The figure exceeded analyst expectations as demand boosted new orders. But the report also indicated that the U.S. manufacturing economy is grappling with record-long lead times, transportation bottlenecks, shortages of critical basic materials and worker absenteeism.

Reports that companies are struggling to find workers have plagued the labor markets in recent weeks, and investors will be paying close attention Friday when the May jobs report is released. The report could end up being a crucial data release for the Federal Reserve as it tries to determine a path for eventually tightening monetary policy. Last month, the April jobs report caught many investors and analysts off guard, with hiring in the U.S. coming in much lower than expected.

Shares of economically sensitive stocks were among those that rallied Tuesday, with the energy and materials sectors posting the biggest gains among the S&P 500's 11 groups.

Marathon Oil rallied $1.65, or 14%, to $13.76 amid news that members of the Organization of the Petroleum Exporting Countries and their allies agreed Tuesday to pump more oil starting in July. The news also sent Brent-crude futures, the benchmark in international energy markets, rallying 1.3% to $70.25 a barrel -- the highest settlement since May 2019. Prices have also been bolstered by a decline in global stockpiles of oil that ballooned in the early stages of the pandemic.

Boeing added $7.71, or 3.1%, to $254.73, while Capital One Financial gained $5.47, or 3.4%, to $166.25. Technology stocks including Twitter pulled back, with the social media company falling 56 cents, or 1%, to $57.44. Microsoft lost $2.28, or 0.9%, to finish at $247.40.

In corporate news, shares of Cloudera jumped $3.07, or 24%, to finish at $15.93. Private-equity firms KKR and Clayton Dubilier & Rice agreed to buy the software company for roughly $5.3 billion in a deal that would take Cloudera private.

AMC Entertainment, a popular stock among individual traders, added $5.92, or 23%, to close at $32.04. The movie-theatre operator said it had sold new shares valued at $230.5 million to Mudrick Capital Management, raising cash at a premium to its closing stock price from Friday.

In the bond market, the yield on the 10-year Treasury note edged up to 1.613%, from 1.592% Friday. Yields, which rise when bond prices fall, have waffled around the 1.6% mark since mid-April.

In overseas markets, the Stoxx Europe 600 rose 0.7%, a new record close. The Shanghai Composite Index rose 0.3%, and Japan's Nikkei 225 ticked down 0.2%.

Write to Joe Wallace at Joe.Wallace@wsj.com and Caitlin McCabe at caitlin.mccabe@wsj.com

(END) Dow Jones Newswires

06-01-21 1730ET