Traders work on the floor of the New York Stock Exchange (NYSE) in New York City, U.S., January 26, 2022.
Traders work on the floor of the New York Stock Exchange (NYSE) in New York City, U.S., January 26, 2022. Reuters / BRENDAN MCDERMID

U.S. stocks swung between losses and gains on Wednesday as Ukraine declared emergency amid a sweeping cyberattack on its state websites in fast-changing developments that raised fears of an all-out war with Russia.

After opening higher, five of the 11 major S&P 500 sectors fell in volatile trading, while a 3.3% drop in Tesla dragged the Nasdaq lower. Fifteen of the 30 Dow components were trading in the red.

In the latest signs of a likely Russian military onslaught, Ukraine declared emergency and told its citizens in Russia to flee, while Moscow began evacuating its Kyiv embassy.

Meanwhile, the websites of Ukraine's government, foreign ministry and state security service remained inaccessible in what the government said was the start of another massive denial of service attack that began at around 1400 GMT.

Wall Street's main indexes gave up early gains and the Nasdaq reversed its 1% jump, while energy stocks jumped 0.8% as oil prices recovered. [O/R]

"Today's action is (driven) by Ukraine and reports of cyber attacks," said Kim Forrest, chief investment officer at Bokeh Capital Partners in Pittsburgh. "It is largely indiscriminate selling, there are more pessimist retail clients."

Meanwhile, a source told Reuters that the Biden administration will sanction company building Russia's Nord Stream 2 gas pipeline.

At 12:24 p.m. ET, the Dow Jones Industrial Average was up 65.05 points, or 0.19%, at 33,661.66, the S&P 500 was up 2.96 points, or 0.07%, at 4,307.72, and the Nasdaq Composite was down 13.44 points, or 0.10%, at 13,368.08.

U.S. stocks have had a turbulent start to 2022 as worsening geopolitical tensions hurt investor sentiment already dented by worries about aggressive policy tightening by the Federal Reserve to combat inflation.

JPMorgan Chase & Co lost 0.5% and led the losses among big banks, while megacap growth names were mixed with Amazon.com Inc down 1%.

The Nasdaq has tumbled 14% so far this year, while the S&P 500 confirmed a correction in the previous session as 70% of its components slipped more than 10% from their record highs and over 200 stocks lost more than 20% of their value.

A Reuters poll shows the benchmark index rising about 11.5% by end-2022.

Lowe's Cos Inc added 3.3% after the home improvement chain raised its full-year sales and profit forecasts.

Cadence Design Systems Inc jumped 7.4% as the microchip design software maker forecast higher-than-expected 2022 profit following strong fourth-quarter results.

Advancing issues outnumbered decliners by a 1.13-to-1 ratio on the NYSE. Declining issues outnumbered advancers for a 1.11-to-1 ratio on the Nasdaq.

The S&P index recorded two new 52-week highs and 23 new lows, while the Nasdaq recorded 20 new highs and 375 new lows.