Donald Trump warned that the stock market was a “big, fat, ugly bubble” just weeks before he was elected. A year later, Wall Street remains on a milestone-shattering run that the president has been eager to tout and tweet about.

The Standard & Poor’s 500 index, the broadest measure of the stock market, has notched 61 record highs and climbed about 21.3 percent in the year since Trump was elected.

That exceeds the S&P 500’s gain in the first-term election anniversaries of all but two presidents since World War II: George H.W. Bush (22.9 percent) and John F. Kennedy (27 percent), according to CFRA Research.

It also outpaces the market’s performance in the same postelection period of several other modern-era White House occupants, including Ronald Reagan (-3.3 percent), Bill Clinton (10.3 percent), George W. Bush (-22.1 percent) and Barack Obama (4.1 percent). But it trails the S&P 500’s gain in the first year after the second-term elections of Clinton (31.7 percent) and Obama (23.4 percent).

The billionaire’s surprise electoral victory initially set off a steep sell-off in Asian markets. But by the end of the day on Nov. 9, 2016, global markets had steadied and the S&P 500 index closed sharply higher. The market’s rally continued for several weeks, driving the major U.S. stock indexes to record highs. This year, stocks have gradually moved higher, clocking new milestones for the indexes along the way.

Since Trump’s election, investors have been betting that the White House and a GOP-controlled Congress will have a clear pathway to cut taxes, relax regulations and enact other business-friendly policies, despite legislative stumbles that have delayed the administration’s efforts.

Yet, the biggest driver of the market’s gains has been strong corporate profits, Wall Street analysts say.

“The most important thing that’s happened is we’ve had very good earnings seasons,” said JJ Kinahan, chief market strategist at TD Ameritrade. “Companies are making money. Earnings drive the market and earnings have been good.”

In recent weeks, more than 400 of the companies in the S&P 500 have reported their results for the July-through-September quarter, and they’ve been so much better than forecast that Wall Street has more than doubled its expectations for third-quarter earnings growth to 6.8 percent, according to S&P Global Market Intelligence.

What’s more encouraging to many investors is that more companies than usual are also reporting higher revenue than analysts had forecast.

Stock prices tend to track corporate profits over the long term, so the better-than-expected earnings growth helps to validate the stock market’s record-setting run, at least somewhat.

Investors have also continued to bet big on economic growth in the U.S. and worldwide as economies in Europe and Asia have bounced back, Kinahan noted.

Since Trump’s election, technology companies have led the way with a 39 percent surge. Banks and industrial and basic materials companies have also soared. Only phone company stocks are down from a year ago.

During the first presidential debate between Trump and his Democratic rival Hillary Clinton in September 2016, Trump cautioned that the stock market was in bubble and that even a small increase in interest rates would bring the market “crashing down.”

That’s not happened, even though the Federal Reserve has raised interest rates twice this year and is expected to do so again next month.

Eight years into the bull market, many analysts expect stocks to keep climbing, at least for the next year. The global economy is improving, corporate profits are rising and inflation remains low but not so low that it makes economists nervous.

On average, the S&P 500 has continued “sailing along” for another year after a president’s first-term election anniversary, before declining 10 percent or more, said Sam Stovall, chief investment strategist at CFRA Research.

He notes that the shortest time was 36 days following Kennedy’s first election anniversary, while the longest stretch was nearly four years after Clinton was elected.

“Should history repeat, and there is no guarantee it will, this bull (market) could continue to surprise investors with its resiliency,” Stovall said.