Trump, in an appearance at the United Nations, said a deal with China could come sooner than expected, lifting stocks.
The remarks came just one day after Trump railed against Chinese “abuses” at the UN summit, comments that had been seen as among the factors causing stocks to fall Tuesday.
The Dow Jones Industrial Average ended up 0.6 percent at 26,970.71.
The broad-based S&P 500 also gained 0.6 percent to 2,984.87, while the tech-rich Nasdaq Composite Index jumped 1.1 percent to 8,077.38.
Investors appeared to take a wait-and-see view of the House Democrat move to launch an impeachment probe of Trump based on his interactions with Ukrainian leader Volodymyr Zelensky.
A memorandum of a call released by the White House showed Trump had urged his Ukrainian counterpart to investigate rival Joe Biden.
Leading Republicans dismissed the matter but Democrats called it a smoking gun.
Among individual companies, Dow member Nike surged 4.2 percent after reporting better-than-expected quarterly profits on strong direct sales and higher revenues from China.
Boeing also added to the Dow’s gains, advancing 1.2 percent as it announced a number of reforms to its board and corporate structure to highlight safety concerns after two crashes led to 346 fatalities and the grounding of its popular 737 MAX plane.
Philip Morris International rose 5.2 percent as it and Altria called off a potential $200 billion merger following a sudden surge in worries about vaping. Altria, which holds a major stake in e-cigarette company Juul, shed 0.4 percent.
Marathon Petroleum surged 8.4 percent after activist fund Elliot Management called for the petroleum product company to be broken up. (AFP)