Investors are heading into 2025 in an optimistic mood, believing that with the economy on a firm footing and the White House in their corner, the stock market will continue to climb.

That wasn’t the case at the start of the year, when even the most bullish analysts underestimated the strength of the market. The S&P 500 index, which was down slightly Tuesday, the final trading day of the year, is on track to rise about 24% this year, roughly matching its gain in 2023. It would be the first time the benchmark index has risen more than 20% in consecutive years since 1998.

Can the rally continue? Wall Street thinks so.

On average, analysts are forecasting that the S&P 500 will rise around 10% in 2025. That includes analysts at Morgan Stanley and JPMorgan Chase, who until recently were bracing for a downturn. John Stoltzfus, chief investment strategist at brokerage firm Oppenheimer, heads into the new year as the most bullish on Wall Street, anticipating a 2025 gain of close to 20%.

After a spike in inflation prompted the Federal Reserve to rapidly raise interest rates in 2022, stocks tumbled as many on Wall Street anticipated a recession. But the downturn never materialized: Inflation gradually cooled, and the Fed began cutting rates this year, further supporting the economy. While the lingering impact of higher prices continues to strain consumer budgets, it has yet to drag down the economy — or the markets.

“This time last year there was so much trepidation and concern over the economy, but in fact it has been incredibly resilient,” said Alan McKnight, chief investment officer at Regions Bank.

In 2024, roughly $500 billion flowed into funds that buy U.S. stocks. More than half of that came in the fourth quarter, after the Fed had begun to cut interest rates, with the two biggest weeks coming after Election Day in November and the most recent Fed rate cut in December.

“Markets just kept climbing the wall of worry,” McKnight said.

Stock indexes continue to be buoyed by multinational tech giants like Apple, Microsoft and Nvidia, with investor exuberance for artificial intelligence pushing up prices of these already richly valued stocks, which have a big influence on the market because of their size. This month, Broadcom, a chipmaker, became the latest company to achieve a trillion-dollar valuation.

The tech-heavy Nasdaq composite is poised for a gain of more than 30% this year, greatly outpacing indexes like the Russell 2000, which tracks smaller companies more linked to the ebb and flow of the domestic economy. The Russell index is set to rise about 10% this year.

Even with the economy in solid shape, analysts’ bullish forecasts are being made against an uncertain backdrop. Some fear the economy could yet falter, with unemployment, credit card delinquencies, corporate debt defaults and bankruptcies creeping up. Other market watchers counter that much will depend on the policies pursued by the incoming administration when Donald Trump takes over.

Proposals to lower corporate taxes and ease regulation are seen by many investors as easy to put in place and broadly positive for company profits and the stock market. But hefty tariffs and widespread deportations risk reigniting inflation, which could stall interest rate cuts and upset the market rally. For now, investors and analysts appear willing to wait for more details from the Trump administration.