U.S. stocks fell on Tuesday, ending the month on a downbeat note after last week’s rally.

The S&P 500 lost 26.09 points, or 0.6%, to close at 4132.15, resuming a downward trajectory after it snapped a seven-week losing streak last week.

The Dow Jones Industrial Average fell 222.84 on Tuesday, or 0.7%, to 32990.12, in the first session of the week after markets reopened from the Memorial Day holiday. Both the S&P and the Dow were roughly flat for the month.

The Nasdaq Composite declined 49.74, or 0.4%, to 12081.39. The technology-heavy index dropped 2.1% in May.

Tuesday’s session capped another volatile trading month, during which stocks around the world swung wildly as traders tried to assess the outlook for global economies. In the U.S., stocks tumbled shortly after May began and continued falling amid a slew of earnings and economic data that came in worse than expected. 

Throughout the month, profit warnings from companies ranging from Snap to Target to Walmart intensified worries about the lingering impact of inflation, and spurred investors to dump shares across several industries.

By mid-May, it seemed the S&P 500 was bound to close in a bear market, defined as a drop of 20% or more from a recent high, before a late-month rally sent stocks higher. The S&P 500 ended the month down about 14% from its January high. 

Professional and individual investors alike waded into last week’s rally in the U.S. markets, finding opportunities to scoop up stocks that have seen their valuations fall. However, the underlying problems that battered stocks earlier this month have yet to abate.

Many traders remain worried that the Federal Reserve’s plans to raise interest rates aggressively could tip the U.S. economy into a recession. Meanwhile, concerns about an economic slowdown in China and sustained supply-chain disruptions due to the pandemic and the war in Ukraine have continued to weigh on investors’ minds.

“There’s a bit of market uncertainty just about the pretty rapid rally we’ve had, and whether that can be sustained in a world where inflation is clearly still a factor,” said Brooks Macdonald Chief Investment Officer Edward Park.

New survey data released Tuesday showed U.S. consumer confidence declined slightly in May from the previous months.

Crude prices jumped after European Union leaders said they would impose an oil embargo on Russia over its invasion of Ukraine, but later pared their gains. Front-month futures for Brent crude, the global benchmark, rose 1% to $122.84 a barrel, their highest settle since March. West Texas Intermediate, the U.S. marker, slipped 0.3% to $114.67 a barrel.

The EU sanctions are set to include a ban on insuring ships that carry Russian oil, The Wall Street Journal reported. They would include an exemption for oil delivered from Russia via pipelines, which make up one-third of EU oil purchases from Russia. Meanwhile, some OPEC members are considering redrawing an oil-production deal to exempt Russia, the Journal reported, which could allow the rest of the organization to boost output.

U.S.-traded shares of Unilever surged $4.35, or 9.9%, to $48.33 after the consumer-goods company said it would add activist investor Nelson Peltz to its board and disclosed his fund now holds a 1.5% stake.

The S&P 500’s energy sector finished May with the largest gain among the benchmark index’s 11 groups, extending a trend that has flourished for much of 2022. Some beaten-down stocks ended the month with gains, such as Netflix, Robinhood Markets and Zoom Video Communications, as investors took advantage of the selloff to hunt for bargains.

“When the S&P 500 is [close to entering] a bear market, that has a big psychological impact on those seeking value,” said

Craig Erlam, senior market analyst at Oanda. “I think the question repeatedly being asked is, ‘Are we seeing a bottom in the markets?'”

In the bond market, the yield on 10-year Treasury notes rose to 2.842% from 2.748% Friday. Bond yields and prices move in opposite directions.

Overseas, the pan-continental Stoxx Europe 600 fell 0.7%, snapping a four-session winning streak, after eurozone inflation rose faster than expected. Consumer prices rose 8.1% on the year in May—the fastest past since records began in 1997—after climbing at a 7.4% rate in April. The inflation report will likely factor into the European Central Bank’s coming interest-rate decisions. Earlier this month, ECB President Christine Lagarde indicated that the central bank could increase its key interest rate in July for the first time in 11 years.

Traders worked on the floor of the New York Stock Exchange on Friday.

Photo: Courtney Crow/Zuma Press

In Asia, the Shanghai Composite Index rose 1.2% after the city’s government said a two-month lockdown would be lifted Wednesday. The shutdown, designed to limit Covid-19 transmission, had slowed the Chinese economy and added to inflationary pressures elsewhere in the world by gumming up supply chains.

Hong Kong’s Hang Seng rose 1.4%. Japan’s Nikkei 225 fell 0.3%.

Write to Caitlin McCabe at caitlin.mccabe@wsj.com, Joe Wallace at joe.wallace@wsj.com and Alexander Osipovich at alexander.osipovich@wsj.com