After a day of frenzied trading, Wall Street recovered from its biggest drop in nearly a year, ending with a slight gain after falling nearly 4% and touching correction territory.

The S&P 500 gained 0.3% to 4,410.13, paring its losses since its Jan. 3 record to about 8%.

Earlier Monday, selling seemed to have triggered a new marker of the abrupt shift in investor thinking this month. The index had fallen more than 10% from that record. A drop of that scale, called a correction on Wall Street, is infrequent. The last time the S&P 500, the U.S. benchmark, was in a correction was March 2020, when a panic over the emerging coronavirus pandemic gripped global markets.

This downdraft came as investors anticipated the Fed will have to raise interest rates quickly this year as it tries to tamp down inflation, which is at its highest level in 40 years. Its main policy interest rate, the federal funds rate, was slashed to near-zero in 2020 as the central bank took extraordinary measures to shore up the economy as it was hit by lockdowns. Those low rates also helped fuel a massive rally in stock prices.

Now that the Fed is likely to take away that support, investors have been rethinking their expectations for corporate profits and what they are willing to pay for stocks. Higher borrowing costs for houses and cars could slow spending and dampen consumer demand as borrowers direct more of their earnings to paying back debt.

“You’re starting to see a shift in psychology,” said John Canavan, an analyst at Oxford Economics.

The Fed is scheduled to hold a policy meeting Tuesday and Wednesday, and while there probably won’t be any significant changes in the central bank’s policy, the attention on the meeting “focuses markets on the broader fact that the Fed is prepared to aggressively remove accommodation they hadn’t expected just a few months ago,” Canavan said.

The first interest rate increase — likely raising the benchmark by a quarter of a percentage point — could come in March, economists expect, with some investors expecting three more to follow this year.

That is a change in outlook since last year, when the Fed first said it would begin to remove some of its support for the economy. Analysts have also noted that the omicron variant of the coronavirus has proved less of a threat to growth than investors might have expected last year — allowing the Fed to focus on controlling inflation, rather than boosting growth.

But investors may have gotten carried away with their concerns over what might happen next, said Gennadiy Goldberg, a senior U.S. rates strategist at T.D. Securities.

Goldberg said the market was “starting to overshoot” and noted some investors Monday were discussing outcomes that the Fed hadn’t indicated, like a large rate hike in March or other rapid moves to choke off inflation, including the possibility of a rate increase at every meeting from now on.

“I wonder how much of that is scaring the market,” he said.