The Nasdaq logo is displayed at the Nasdaq Market site in Times Square in New York City, U.S., December 3, 2021.
The Nasdaq logo is displayed at the Nasdaq Market site in Times Square in New York City, U.S., December 3, 2021. Reuters / JEENAH MOON

The S&P 500 was little changed in rocky trading on Tuesday, as investors weighed fast-paced developments around the crisis in Ukraine as the United States banned Russian oil and other energy imports over the invasion.

Tuesday's up-and-down session for Wall Street's main indexes came a day after steep declines that saw the tech-heavy Nasdaq confirm it was in a bear market.

U.S. President Joe Biden announced the ban on Russian oil and other energy imports, underscoring strong bipartisan support for a move that he acknowledged would drive up U.S. energy prices, while Britain said it would phase out imports of Russian oil and oil products by the end of 2022.

"There is a just a lot of uncertainty right now of what the impact is going to be on the U.S. economy," said James Ragan, director of wealth management research at D.A. Davidson. "We expect ongoing volatility... but I think there are buyers out there."

The Dow Jones Industrial Average rose 64.79 points, or 0.2%, to 32,882.17, the S&P 500 gained 0.48 point, or 0.01%, to 4,201.57 and the Nasdaq Composite added 55.33 points, or 0.43%, to 12,886.29.

Defensive sectors were the biggest decliners, with consumer staples and healthcare both dropping more than 1% each. Gains in megacap growth stocks, such as Tesla, Meta Platforms and Alphabet, helped support the S&P 500.

The energy sector, a standout performer this year, continued its charge higher, rising 1.5%.

Brent crude topped past $130 per barrel along with other commodities, triggering alarm over surging inflation and the impact on global economic growth. U.S. gasoline prices hit an all-time record on Tuesday.

"I think we will see a little pullback in the U.S. consumer. Obviously, the gasoline prices are going to cause people to pause a little bit," Ragan said.

Ukraine's government accused Russian forces of shelling a humanitarian corridor that Moscow, which describes its actions as a "special operation", had promised to open to let residents flee the besieged port of Mariupol.

Stocks have struggled as concerns about the Russia-Ukraine crisis have deepened a sell-off initially fueled by worries over higher bond yields as the Federal Reserve is expected to tighten monetary policy this year to fight inflation.

On Monday, the Nasdaq confirmed it was in a bear market, falling over 20% from its record high, while the Dow Jones Industrial Average confirmed it was in a correction as it closed more than 10% lower from its record peak.

In company news, shares of Caterpillar Inc jumped 7% after Jefferies upgraded the construction equipment maker's stock to "buy" from "hold" as a hedge against inflation and prospects of more investments.

Advancing issues outnumbered declining ones on the NYSE by a 1.15-to-1 ratio; on Nasdaq, a 1.26-to-1 ratio favored advancers.

The S&P 500 posted 18 new 52-week highs and 76 new lows; the Nasdaq Composite recorded 31 new highs and 500 new lows.