The Dow Jones industrial average and Standard & Poor’s 500 indexes soared to their biggest gains since the presidential election on Wednesday and set all-time highs.

Investors bought stocks that do well in times of faster economic growth, like technology and industrial companies, in expectations of a post-election acceleration in the economy.

They also snapped up stocks that pay large dividends. Bond yields, which had risen since the election, declined, as investors speculated the European Central Bank will extend its asset buying program to put downward pressure on rates. Lower yields fueled demand for dividend-yielding stocks.

Phone and real estate companies made the largest gains, but airlines, railroads and trucking companies also soared.

Investors took the rally in transportation stocks as a sign of optimism about economic growth. Technology and consumer-focused companies also jumped.

Biotech drug companies took steep losses after President-elect Donald Trump said he wants to reduce drug prices.

advertisement | advertise on newsday

The transportation sector reached an all-time high for the first time in two years, a sign businesses will start spending more.

“The consumer has really been the engine of the economy,” said Julian Emanuel, an equity strategist for UBS. “The missing piece has been the corporate side, the industrial side.”

The Dow Jones industrial average jumped 297.84 points to 19,549.62. The Standard & Poor’s 500 index rose 1.32 percent to 2,241.35. The Nasdaq composite rose 1.14 percent to 5,393.76. That was about 5 points short of its all-time high.

The Russell 2000 index of small-company stocks set its own record as it gained 11.84 points, or 0.88 percent, to close at 1,364.51.