Strong company earnings put investors in a buying mood Thursday, lifting the major U.S. stock indexes to record highs.

Banks and other financial companies led the rally as bond yields rose. Energy also notched big gains as crude oil prices rose. Utilities and materials lagged the broader market.

advertisement | advertise on newsday

Traders have been focused in recent weeks on companies reporting their quarterly results as they size up Corporate America’s prospects for growth. They’re also trying to gauge whether the Trump administration will deliver on expectations of business-friendly policies that helped drive a market rally last fall.

“You’re definitely seeing a kind of risk-on (trade) right now, with the fear of missing out overshadowing the fear of a policy mistake,” said Chris Zaccarelli, chief investment officer for Cornerstone Financial.

The Dow Jones industrial average rose 118.06 points, or 0.6 percent, to 20,172.40. The Standard & Poor’s 500 index gained 13.20 points, or 0.6 percent, to 2,307.87. The Nasdaq composite index added 32.73 points, or 0.6 percent, to 5,715.18. The Nasdaq has now set a record high three times this week, in addition to last Friday.

The Russell 2000 index of small-company stocks outpaced the rest of the market. It climbed 19.79 points, or 1.5 percent, to 1,378.53.