U.S. stocks climbed on Tuesday after a retreat in oil prices eased investors’ concerns about inflation and the prospect that the Federal Reserve will move more aggressively to lift interest rates.

Oil’s decline came as investors waited for Wednesday’s decision by the Fed, which is expected to raise rates for the first time since 2018. Russia’s invasion of Ukraine had increased prices on the commodity well above $100 a barrel, raising the stakes for the U.S. economy and its central bank.

The Dow Jones Industrial Average advanced 599.10 points, or 1.8%, to 33544.34. The S&P 500 climbed 89.34 points, or 2.1%, to 4262.45, while the Nasdaq Composite added 367.40 points, or 2.9%, to 12948.62.

The major U.S. benchmarks opened higher and then gained strength throughout the afternoon. The S&P 500 and Nasdaq snapped three-day losing streaks. 

Oil prices dropped back below $100, undoing much of the price surge since Russia invaded Ukraine. West Texas Intermediate, the U.S. benchmark, dropped over 6% to $96.44 a barrel. Brent crude, the international benchmark, declined over 6% to $99.91 a barrel. Delta Air Lines closed at $34.86, up $2.79, or 8.7%. American Airlines rose $1.32, or 9.3%, to $15.57, and United Airlines climbed $3.22, or 9.2%, to $38.24.

Russia’s invasion of Ukraine could weigh on global demand for oil, according to a monthly market report from the Organization of the Petroleum Exporting Countries. Energy shares retreated, as Valero Energy tumbled 6.8%, the most of any S&P 500 stock, losing $6.14 to close at $84.41. Baker Hughes slipped 5.7%, or $2.11, to $34.87; Exxon Mobil also fell 5.7%, or $4.66, to close at $77.22.

“You have this negative correlation right now where when oil goes up, the market goes down, and when oil is down the market goes up,” said Jack Janasiewicz, lead portfolio strategist for Natixis Investment Managers Solutions. “If you can get oil to calm down to preinvasion levels, it gives us a little more confidence that inflation is not running away and making things more difficult for the Fed.”

Oil prices fell as investors weighed what Beijing’s sweeping Covid-19 lockdowns will mean for demand.

Chinese indexes slid, extending a recent rout fueled by the country’s rising Covid-19 caseload, renewed regulatory pressure from Beijing and the threat of U.S. delistings of Chinese stocks. China’s daily cases more than doubled, the government said Tuesday, in an outbreak that has prompted lockdowns in major cities and an entire province.

The mainland Chinese CSI 300 index of blue-chip stocks fell 4.6% to register its lowest close since June 2020. In Hong Kong, the Hang Seng sank 5.7%, ending at a six-year closing low, as large technology and financial stocks cratered. 

A clampdown in travel and retail spending in China, coupled with supply-chain disruptions, adds yet another complication to a global economy already dealing with the war in Ukraine and the highest inflation in a generation.

“The headlines that Covid is swirling throughout China is something else that stokes uncertainty in global markets because it adds to concerns about supply chain disruptions,” said David Donabedian, chief investment officer at CIBC Private Wealth.

Shares of Nvidia,

Advanced Micro Devices and other chip makers also rose, as investors flocked to technology companies more sensitive to the economy’s outlook. As a group, information-technology stocks posted the biggest gains in the S&P 500.

Fed officials are set to meet Tuesday, the beginning of a two-day policy meeting that comes against a backdrop of 40-year-high inflation and concerns that Russia’s invasion could hurt global economic growth. While the Fed is expected to stick to its plans for a cycle of rate rises beginning with a quarter-percentage-point increase Wednesday, investors are looking for clarity on how the war in Ukraine might affect the pace of future tightening. 

A delegation of European leaders headed Kyiv on Tuesday to meet with Ukraine’s president and offer his country a broad package of support. Meanwhile, Russia continued to lob more missiles at the capital city.

U.S. Treasury yields pulled back ahead of the meeting after rising to their highest level in over 2½ years on Monday. The yield on the benchmark 10-year note fell to 2.122% from 2.139% on Monday. Bond yields and prices move in opposite directions. Gold fell 1.6%, its third consecutive retreat and fourth in five sessions.

Investors were also considering fresh data on producer prices. The producer-price index, which generally reflects supply conditions, rose a seasonally adjusted 0.8% in February, according to the Labor Department, down from January’s upwardly revised 1.2% rise.

Investors read the drop in oil prices and a slowdown in producer prices as signs the Fed may not need to raise interest rates as aggressively to stave off inflation, said Tim Murray, capital market strategist at T. Rowe Price Group Inc.

“If lower oil means lower inflation, it would hopefully mean a lower end point for Fed tightening,” Mr. Murray said. “Rates are the No. 1 issue for U.S. stocks.”

Investors have been concerned that the Russia-Ukraine conflict would push inflation even higher by cutting off Russia’s sizable supplies of oil and gas and snarling shipments of key metals and grains. They worry the shock could crimp the growth of the global economy just as it gets over the impact of Covid-19 lockdowns.  

“The fundamental challenge for investors is that the invasion of Ukraine stokes inflation, which was already an issue of concern, but also injects doubt into the outlook for economic growth,” said Mr. Donabedian. “It’s a one-two punch in terms of elevating uncertainty.”

Marathon Petroleum’s refinery in Los Angeles. Oil prices dropped back below $100 a barrel Tuesday.

Photo: BING GUAN/REUTERS

Heightening that uncertainty is the threat of an escalation, as the latest diplomatic efforts to end the fighting have shown little signs of progress. Investors are growing increasingly concerned that a conflict that many people just weeks ago thought wouldn’t happen could now spill beyond Ukraine’s borders, said Mr. Donabedian.

Reports that China is considering supplying military aid to Moscow raise the threat that Western sanctions could be targeted at Beijing, he added. “That would open up a whole new Pandora’s box,” he said.

Elsewhere, the Stoxx Europe 600 dropped 0.28%, led by its raw-materials and energy sectors, while the FTSE 100 fell 0.2%. Japan’s Nikkei 225 eked out a 0.2% gain.

—Quentin Webb contributed to this article.

Write to Justin Baer at justin.baer@wsj.com and Will Horner at william.horner@wsj.com