Stock markets are supposed to drop when the Fed hikes interest rates. So why are they rallying now?

Stock markets aren’t behaving the way they’re supposed to.

U.S. markets surged after the U.S. Federal Reserve announced its long-awaited interest rate hike on Wednesday, increasing interest rates by a quarter point and signaling there might be six more rate hikes this year.

In theory, higher interest rates are supposed to make stocks less attractive, because higher rates mean increased borrowing costs for companies and consumers, lowering overall spending. But investors shirked that conventional wisdom and piled into the stock markets, rallying the S&P 500 to close 2.2% higher than the start of the day.

The S&P 500 dipped briefly into the red immediately after Fed chair Jerome Powell announced rate hikes, but recovered to end at a hight for the day. The Dow Jones Industrial Average also went into negative territory briefly before recovering to end 1.6% higher. The NASDAQ followed a similar pattern—a brief dip after the Fed’s announcement, only to surge to close 3.7% higher for the day.

“Usually, the stock market is reflecting what’s best for the economy, so if interest rate hikes are best for the economy, then stocks will respond to that,” Andrew Hiesinger, CEO of Quant Data, told Fortune.

U.S. markets already started strong Wednesday, on news of positive movement in negotiations between Ukraine and Russia, as well as signals from Beijing that it would start to roll back its broad regulatory crackdown. And, rather than worrying that rate hikes would affect equity values, investors may just be relieved that the Federal Reserve is taking action to fight the highest level of inflation in decades.

The rate hike “seems very much like [the Federal Reserve] wanted to send a message that they’re fighting inflation and they’re going to fight it fast and get it under control,” Kathy Jones, chief fixed income strategist at the Schwab Center for Financial Research, told the Wall Street Journal.

Investors may also have been reassured by Powell’s belief that the U.S. economy was strong enough to withstand more restrictive monetary policy measures.

“Monetary tightening means the Fed believes the economy is on solid footing, which is a good thing at the end of the day”, Mike Loewengart, managing director of investment strategy for E-Trade, told CNBC.

Historical patterns suggest that while stocks tend to fall in the month after a rate hike, they end up recovering to see solid gains within a year. An analysis by Evercore ISI found that in the previous four rate hike cycles—periods where the U.S. Federal Reserve steadily increases interest rates—the S&P 500 fell by 4% in the first month, yet was 5% higher on average one year later.

Market optimism continued into morning hours in Asia. The Nikkei opened 3% higher, while the Hang Seng opened 6.6% higher, continuing its 9% surge from the day before.

This story was originally featured on Fortune.com