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.

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 keeping an eye on Washington, D.C., to gauge whether the Trump administration will deliver on expectations of business-friendly policies that helped drive a 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. “You’re seeing a recovery in corporate profits, and that’s definitely giving investors some extra confidence.”

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.

About 61 percent of companies in the S&P 500 reported earnings as of Wednesday. Company earnings in the October-December quarter are up 6.7 percent from a year earlier.