U.S. stocks finished mostly higher Monday and oil prices fell after data showed a slowdown in China’s economy.

The S&P 500 reached its 49th record close of the year by gaining 11.71 points, or 0.3%, to 4479.71 after being in the negative territory most of the day, the largest comeback since late March, according to Dow Jones Market Data.

The Dow Jones Industrial Average rose 110.02 points, or 0.3%, to 35625.4, to end the trading day at its 35th record close of 2021. The blue-chip index also finished last week at a high. Today’s close marks five consecutive trading sessions of new highs for both benchmarks.

The tech-heavy Nasdaq lost 29.14 points, or 0.2%, to 14793.76.

Stocks have ground higher in thin summer trading, buoyed by a bumper set of quarterly earnings reports from American companies. However, investors remain wary of the damping effect of the Delta variant of Covid-19 on business activity, and potential pitfalls including geopolitical uncertainty and a possible end to the Federal Reserve’s asset-purchase program by mid-2022.

“Although we had a generally great earnings season this past quarter, we may be past the peak of recovery,” said Sean Sun, portfolio manager at Thornburg Investment Management, who is buying stocks tied to digital transformation themes. “The market kind of sees the storm on the horizon—Delta flare ups everywhere and weak consumer confidence.”

The highly infectious Delta variant has taken a toll on the economic recovery in China, where data published Monday showed growth in industrial, consumer and investment activity slowed in July. Investors said the world’s second-largest economy has likely continued to lose steam in August, following the shutdown of a major port and the introduction of travel restrictions to contain the virus.

“That is the reason why the market is a bit nervous today,” said Andrea Carzana, a fund manager at Columbia Threadneedle Investments, adding that European companies were particularly exposed to China’s economy.

Stocks are still the best place for investors to park money, according to Mr. Carzana. He noted that a majority of companies beat analysts’ estimates for profits and revenue this earnings season.

With Monday’s move, the S&P 500 is now up more than 100% since its 2020 closing low on March 23 of that year. It is the fastest doubling of the index since 1933, according to Dow Jones Market Data.

Moderna Inc. slipped $15.92, or 4.1%, to $373.86. Tesla Inc. declined $31, or 4.3%, to $686.17, while Advanced Micro Devices Inc. fell $3.07, or 2.8%, to $107.48 and Nvidia Corp. slid $2.38, or 1.2%, to $199.50.

In the bond market, the yield on 10-year Treasury notes fell to 1.255%, the lowest in more than a week. Yields move in the opposite direction to bond prices.

The Chinese data weighed on prices of industrial commodities. Brent crude, the benchmark in international energy markets, lost $1.08 per barrel, or 1.53%, to $69.51, the largest decline in nearly a week.

“Anytime you have some kind of geopolitical disturbance, anytime there is concern that demand may fall, then you’re going to see oil come down,” said Victoria Fernandez, chief market strategist and portfolio manager at Crossmark Global Investments.

Copper, a bellwether for the global economy because of its use in construction and manufacturing, lost 6.5 cents per pound, or 1.5% to $4.32.

In overseas markets, the Stoxx Europe 600 slipped 2.38 points, or 0.5%, to 473.45. That puts the regional benchmark on track to snap a 10-day winning streak, its longest since 2006. Shares of companies in the travel and leisure, retail, resources and oil-and-gas sectors led the losses.

The S&P 500 clinched its 49th record close of the year Monday.

Photo: Michael Nagle/Bloomberg News

Asian markets were mixed. China’s Shanghai Composite Index ticked up 1.05 points, or less than 0.1%, to 3517.34, while Japan’s Nikkei 225 fell 453.96, or 1.6%, to close at 27523.19.

Write to Joe Wallace at Joe.Wallace@wsj.com