The Dow Jones Industrial Average rose 108.49 points to 24,748.73, while the S&P 500 gained 0.3 percent to end the day at 2,682.20. The Nasdaq Composite just above the flatline at 7,082.70. At its low of the day, the Dow dropped more than 200 points.
The indexes rose after National Economic Council Director Larry Kudlow said the White House was having "a lot of communication with the Chinese government at all levels" ahead of a meeting between Trump and his Chinese counterpart, Xi Jinping. Kudlow later told reporters Trump thinks there is a "good possibility" the two countries can reach and agreement. Shares of Boeing, considered a trade bellwether for the company's high exposure to overseas markets, hit its high of the day before closing 0.5 percent higher.
"The whole year comes down to the next few weeks," said Brent Schutte, chief investment strategist for Northwestern Mutual Wealth Management. "Most of what's happening is geopolitics-related. If we can get clarity on any of those things (tariffs, Brexit, the Italian budget), especially tariffs, that would be positive for the market."
Victor J. Blue | Bloomberg | Getty Images
A trader works on the floor of the New York Stock Exchange (NYSE) in New York, U.S.,
Comments from Federal Reserve Vice Chairman Richard Clarida helped stocks bounce back from their lows on Tuesday. Clarida said the central bank was "much closer" to a neutral rate than it was in December 2015, the first time the Fed hiked since the financial crisis. "How close is a matter of judgment, and there is a range of views on the FOMC," he said.
Clarida's remarks come ahead of Fed Chairman Jerome Powell's speech on Wednesday at the Economic Club of New York.
The moves on Tuesday followed a strong finish on Wall Street in Monday's session. The Dow closed more than 350 points higher on Monday while the S&P 500 also rose more than 1 percent.
"Overall, this rally will be tentative until S&P can get up above 2700 and produce a stronger session of positive breadth, momentum and volume," said Mark Newton, managing member at Newton Advisors, in a note. "Until that happens, it is tough making too much of this rally, as momentum and trends remain negatively sloped on daily and weekly timeframes."
Stocks have been under pressure recently as shares like Facebook, Amazon, Apple, Netflix and Google-parent Alphabet entered bear-market territory. Investors have also fretted over the Federal Reserve's plans to tighten monetary policy. The central bank is largely expected to hike rates next month.
Shares of General Motors dropped 2.5 percent to their session low after Trump tweeted the administration is considering cutting the company's subsidies after closing several plants in the U.S.
—CNBC's Alexandra Gibbs contributed to this report.