By Charles Riley, CNN Business

The S&P 500 has surged nearly 5% so far this week, putting the index on track for its best weekly performance since November 2020.

What?

That’s right. Investors have put US stocks on course for a banner performance this week even as war raged on in Ukraine, Russia teetered on the brink of default and the Fed hiked rates for the first time since 2018.

The International Energy Agency also warned this week of the biggest oil supply crisis in decades. Analysts are worried that war in Ukraine could result in global food shortages. The West continues to announce new sanctions targeting Russia.

Energy, metals and currency markets have responded to these seismic events with wild swings. Nickel prices have dropped sharply following a trading halt in London that lasted a week.

But stocks are charting their own path, suggesting that investors may be starting to tune out the war in Ukraine.

“In the end, most asset classes seemed to throw their hands up and go with whatever suited their narrative,” said Jeffrey Halley, senior market analyst at OANDA.

The “perpetually bullish gnomes of the equity market” pushed stocks higher on Thursday after positive US manufacturing and labor market data, he added.

Yet there may be some logic behind the stock moves.

Stock market volatility is here – no signs of letting up

Enter the Fed

The US central bank struck a more hawkish tone at its meeting this week than many investors expected. The median forecast from policymakers is now for seven rate hikes this year, and three more in 2023.

Yet US stocks gained more than 1% on Thursday. Analysts at UBS don’t see that as inconsistent.

They gave three reasons:

  1. Fed Chair Jerome Powell convinced investors that the US economy is strong enough to withstand higher rates. Economic data has continued to strengthen, he said, and the labor market is very tight.
  2. The bond market suggests that weaker growth is ahead. But a recession, if it comes, could still be years away.
  3. Stocks often rally when the Fed starts hiking interest rates. Since 1983, the S&P 500 has returned an average of 5.3% in the six months following the first Fed rate rise of a cycle, according to UBS.

“We advise investors to prepare for higher rates while remaining engaged with equity markets. We prefer a hedging strategy and selective equity exposure over exiting risk assets,” the bank’s analysts wrote.

Energy stocks provide a hedge against risks from the war in Ukraine, they said.  Financial stocks also tend to rise when interest rates move higher.

The-CNN-Wire™ & © 2022 Cable News Network, Inc., a WarnerMedia Company. All rights reserved.