Stocks posted strong weekly gains, led by tech shares, as investors cheered renewed optimism on the U.S.-China trade front on Friday.

The Dow Jones Industrial Average climbed 138.93 points to 25,848.87 as Boeing shares turned around to close 1.5 percent higher. Boeing's turnaround was sparked by a report saying the company planned to roll out a software upgrade for its 737 Max aircraft. The stock had been under pressure all week after an Ethiopian Airlines flight using a 737 Max plane crashed on Sunday, which prompted several countries to ground flights involving the plane.

Gains in the tech and consumer discretionary sectors pushed the up 0.5 percent to 2,822.48. Tech shares also bolstered the Nasdaq Composite, which climbed 0.8 percent to 7,688.53.

The S&P 500 and Nasdaq Composite both rose at least 2.9 percent, though the laggard Dow gained only 1.7 percent amid Boeing's troubles. The S&P 500 also posted its biggest one-week gain since November.

Stocks have been on a tear this year, with the three major indexes rising more than 10 percent each in 2019.

"Coming off the lows in December, we thought that was a volatility event. We thought we could get back to those all-time highs by about late March to early April," said Craig Callahan, president at Icon Funds. Valuations "still backs up that view."