NEW YORK — U.S. stocks powered to their biggest gain in almost nine months Friday as drugmakers and technology companies surged. Investors were cheered that President Trump appeared to take a more positive tone on international trade.

AbbVie boosted biotechnology companies with a strong fourth quarter and a greater annual profit forecast, while Pfizer and other drugmakers also made big gains. Intel had its best day in almost nine years after its fourth-quarter results reassured investors that security flaws recently discovered in its processors aren’t damaging its sales. Wynn Resorts tumbled following numerous allegations of sexual assault and harassment by Steve Wynn, the casino operator’s chairman, CEO and biggest shareholder.

Speaking at the World Economic Forum in Davos, Trump said Friday that leaders should prioritize their own countries, but that his administration isn’t opposed to international cooperation and that continued growth for the U.S. economy is good for the rest of the world.

“He did talk about making sure trade deals are fair, but I just thought it was a completely different tone today,” said JJ Kinahan, chief investment strategist for TD Ameritrade. “I think the market really took a lot of positives away from that.”

On Wednesday and Thursday, comments from Trump as well as Treasury Secretary Steven Mnuchin and Commerce Secretary Wilbur Ross contributed to swings in stock prices and the dollar as investors tried to parse the remarks for indications of administration’s stances on the dollar and international trade.

The Commerce Department said the U.S. economy grew 2.6 percent in the fourth quarter. That was a bit less than analysts predicted but still a solid result, as Americans continued to shop and home construction increased. The economy grew 2.3 percent in 2017 and experts think growth will speed up this year, partly because of the tax cut package signed into law in December.

The Standard & Poor’s 500 index climbed 33.62 points, or 1.2 percent, to 2,872.87, its biggest gain since March 1. The Dow Jones industrial average added 223.92 points, or 0.8 percent, to 26,616.71. The Nasdaq composite rose 94.61 points, or 1.3 percent, to 7,505.77. The Russell 2000 index of smaller-company stocks gained 6.39 points, or 0.4 percent, to 1,608.06.

Already at record highs, the S&P 500 is up 7.5 percent in January and on track for its largest monthly increase since October 2015.

Technology and industrial companies made hefty gains, as did Amazon and other retailers, and banks rose along with interest rates. Those companies tend to benefit from more global trade and faster economic growth.