Trump, who was speaking to reporters after talks with Chinese Vice Premier Liu He, also said the two countries are close to ending their trade war.
The market had risen sharply earlier in the day due to optimism for an agreement.
"Anything that was less than a comprehensive agreement was likely to see some degree of market sell off," said Michael James, managing director of equity trading at Wedbush Securities in Los Angeles.
"The timing had a lot to do with the volatility. There were 15 minutes to go in the trading day on a Friday... after the Dow had risen 700 points in the last two days," he said.
Top-level discussions between the two countries concluded their second day on Friday.
Cyclicals were among the day's best-performing groups, with the S&P industrial index up about 2% ahead of the third-quarter earnings season, which is set to begin next week.
The Dow Jones Industrial Average rose 319.92 points, or 1.21%, to 26,816.59, the S&P 500 gained 32.14 points, or 1.09%, to 2,970.27 and the Nasdaq Composite added 106.27 points, or 1.34%, to 8,057.04.
Indexes also gained for the week, with the Dow and Nasdaq each up 0.9% and the S&P 500 up 0.6%.
Analysts expect S&P 500 earnings to have declined 3.2% year-on-year in the third quarter, which would mark the first decline since 2016, according to IBES data from Refinitiv.
Bets for another interest rate cut by the Federal Reserve fell after data showed a rise in consumer sentiment for the month of October.
Apple's stock rose as Wedbush raised its price target, citing confidence in the company's new video streaming service.
The industrial index was boosted by a surge in shares of Fastenal Co after the industrial distributor beat quarterly profit expectations.
Advancing issues outnumbered declining ones on the NYSE by a 3.14-to-1 ratio; on Nasdaq, a 3.08-to-1 ratio favored advancers.
The S&P 500 posted 27 new 52-week highs and no new lows; the Nasdaq Composite recorded 44 new highs and 60 new lows.
Volume on US exchanges was 7.55 billion shares, compared to the roughly 7 billion average for the full session over the last 20 trading days.