Tech stocks lifted the S&P 500 Wednesday, leaving the broad U.S. stock index hovering just shy of its record close from early May.

The benchmark index edged up less than 0.1%, boosted by gains in Microsoft and Amazon.com. The tech-heavy Nasdaq Composite gained 0.2%, while the Dow Jones Industrial Average edged down 0.1%, or about 30 points.

The S&P 500 has been subdued for much of the last two weeks as investors weigh the reopening of the economy against rising inflation and supply-chain concerns. The onset of summer months is prompting people to start taking vacation, leading to thinner trading volumes, money managers said.

“We’ve seen very low volatility over the past week,” said John Roe, head of multiasset funds at Legal & General Investment Management. “As we get into the warmer weather, we have less market participants and a less volatile environment. This reduces liquidity.”

The recent volatility in so-called meme stocks, which have gained popularity on online forums, continued Wednesday. Clover Health Investments shares climbed 15% after surging 86% on Tuesday. AMC Entertainment Holdings, by contrast, dropped 9.2%.

Worries about runaway inflation have abated in recent days, although investors remain on watch for fresh data on inflation in May that is due Thursday.

“The debate around how persistent inflation is and will be for the coming months is key. This might create some volatility,” said Luc Filip, head of private banking investments at SYZ Private Banking. Last month’s “higher than expected [consumer-price index] figures triggered quite a bit of market stress,” he added.

Fresh data Wednesday showed a higher-than-expected spike in China’s producer prices in May, driven by a rise in commodity prices. The consumer-price index came in below forecasts, signaling that the higher costs haven’t yet been passed onto consumers.

“When you look at the global inflation picture, it is very interesting to see that actually, inflation isn’t such a problem currently in Asia,” Mr. Filip said.

In bond markets, the yield on the benchmark 10-year U.S. Treasury note declined to 1.472%, from 1.527% on Tuesday.

“This is about positioning,” said James Athey, investment manager at Abrdn Standard Investments. “There is a big risk event coming up with CPI, people aren’t incentivized to add a lot of risk into the event.”

A trading post on the floor of the New York Stock Exchange on May 22, 2020.

A trading post on the floor of the New York Stock Exchange on May 22, 2020.

Photo: brendan mcdermid/Reuters

Overseas, the pan-continental Stoxx Europe 600 was relatively flat after notching a fresh record on Tuesday.

The Shanghai Composite Index ticked up 0.3% by the close of trading, while Hong Kong’s Hang Seng Index edged down 0.1%. Japan’s Nikkei 225 slid 0.4%.

Write to Anna Hirtenstein at anna.hirtenstein@wsj.com