BY THIS time last year, the stock market鈥檚 rally had blown past even the most optimistic targets and Wall Street forecasters were convinced it couldn鈥檛 keep up the dizzying pace.

So as strategists at Bank of America Corp., Deutsche Bank AG, Goldman Sachs Group Inc. and other big firms sent out their calls for 2024, a consensus took shape: After surging more than 20% as artificial intelligence (AI) breakthroughs unleashed a tech-stock boom and the economy kept defying the doomsayers, the S&P 500 Index would likely scratch out only a modest gain. As the Federal Reserve shifted to cutting interest rates, Treasuries were seen as ripe to give equities a run for their money.

What followed, instead, delivered another humbling to Wall Street prognosticators who have been caught off guard by the market鈥檚 twists and turns ever since the end of the pandemic.

Rather than lose steam, equity prices continued to soar higher. By late January, the S&P 500 had already surpassed the average year-end target from strategists. It went on to hit one record high after another and is heading to a 25% gain in 2024, capping the strongest back-to-back annual runs since the dot-com bubble of the late 1990s.

鈥淭here is an element of miraculousness to it,鈥 said Julian Emanuel, chief equity and quantitative strategist at Evercore ISI, who by mid-year abandoned his call for a slight dip in the S&P 500 and was the first among major strategists to introduce a year-end target of 6,000. 鈥淭rends can go on longer and go farther than one could ever imagine.鈥

The continuation of that trend is a testament to how much the post-pandemic economy has confounded forecasters by steadily expanding even after the Fed pushed interest rates to a more than two-decade high.

As 2023 was drawing to a close 鈥 and bonds were rallying strongly on speculation that the central bank would need to start easing policy aggressively 鈥 fixed-income strategists were predicting that the benchmark 10-year Treasury yield would drift lower to end this year around 3.8%. It has risen to eclipse 4.6% instead.

The economy鈥檚 strength has supported the stock market鈥檚 rise by trickling down to corporate profits. At the same time, excitement about AI continued to push up the stocks of big tech companies like Alphabet, Inc., Amazon.com, Inc., Apple, Inc., Meta Platforms Inc. and Nvidia Corp. The rally got another boost from Donald J. Trump鈥檚 presidential victory by promising tax cuts and corporate-friendly policies.

The result has largely extinguished bearish sentiment on Wall Street and driven some strategists to capitulate by ditching pessimistic calls.

Morgan Stanley鈥檚 Mike Wilson 鈥 who in 2023 delivered a drumbeat of warnings that equities were poised to slide 鈥 by this May turned positive on stocks. JPMorgan Chase & Co.鈥檚 Marko Kolanovic, who had predicted the S&P 500 would tumble 12% by December, left the bank in mid-2024 after two decades at the firm. In late November, Dubravko Lakos-Bujas, who now heads JPMorgan鈥檚 market research team, dropped the previously bearish target and predicted the S&P 500 will keep climbing next year.

Mr. Lakos-Bujas said some of the team鈥檚 missteps reflected the difficulty of anticipating the surge of the so-called Magnificent Seven tech stocks, which account for an outsized chunk of the S&P 500鈥檚 gains. But he said there鈥檚 solid reasons for the optimism from here, citing an easing Fed, the change of power in Washington, and a Chinese government that鈥檚 eager to keep its economy humming.

鈥淲e have effectively three puts in place,鈥 said Mr. Lakos-Bujas, who expects the S&P 500 to rise to 6,500 next year, a gain of about 9% from Friday鈥檚 level. That 鈥渟hifted our thinking process in terms of risky assets and equities.鈥

It wasn鈥檛 only the pessimists who were caught off guard. Almost every top strategist tracked by Bloomberg boosted their S&P 500 targets at least once this year after the index shot through them.

When the targets were first published in late 2023, even the most bullish forecasters at the time 鈥 Fundstrat鈥檚 Tom Lee and Oppenheimer鈥檚 John Stoltzfus 鈥 expected the S&P 500 to rise only about 9% to 5,200, a level that it surpassed in less than three months.

There were some moments when it looked like the stock market was due for a reversal but they proved short lived. While the S&P 500 slid from mid-July through early August, it soon resumed its march higher as worries about tech earnings faded. A selloff sparked by Fed Chair Jerome Powell鈥檚 hawkish tone this month also quickly reversed.

The steep climb, of course, has sown some concern that valuations have become too stretched. That鈥檚 particularly acute for companies tied to AI, given uncertainty about whether the technology will live up to its promise. And the market鈥檚 embrace of Mr. Trump鈥檚 victory ignores the risks posed by his tariff and tax-cut plans, which could rekindle inflation and stymie global trade.

But few are calling for the rally to end. In fact, none of the 19 strategists tracked by Bloomberg expects the S&P 500 to decline next year. Even the lowest forecast sees the benchmark holding steady; the most optimistic 鈥 at 7,100 鈥 implies a 19% rally.

Binky Chadha, chief US equity and global strategist at Deutsche Bank, has been among the bullish cohort on Wall Street for the past three years. His 2025 target of 7,000 points is among the most optimistic, reflecting his expectation for continued economic growth and low unemployment. He said he鈥檚 not worried about being caught offsides.

Forecasting markets means taking it 鈥渁 year at a time,鈥 he said. 鈥淚n a typical year, equities will pull back by 3% to 5% every two to three months. Does that mean you shouldn鈥檛 buy equities? No, you should because they鈥檙e going back up.鈥 Bloomberg