Shares of Boeing and Caterpillar, among the worst hit on Wednesday after China retaliated with $50 billion in tariffs on U.S. goods such as soybeans, autos, and some types of aircraft, rose 1.7 percent and 3 percent.
"There is a lot of bad news on the trade front built into the market. So the ability of the equity markets to push significantly lower is going to be limited," said John Brady, senior vice president at R.J. O'Brien & Associates in Chicago.
"We're going to need brand new, bad news on trade for the equity markets to push lower."
If current gains for S&P 500 hold, it would be the best three-day run since Trump's election victory in November 2016.
The S&P 500 index showed four new 52-week highs and one new low, while the Nasdaq recorded 47 new highs and 24 new lows.
On Wednesday, the Dow bounced back from a 500 point fall earlier to close up about 230 points after President Donald Trump's top economic adviser Larry Kudlow said the administration was involved in a "negotiation" with China rather than a trade war.
Economic data on Thursday showed the U.S. trade deficit increased to a near 9-1/2-year high in February, but the shortfall with China narrowed sharply. While exports to China were unchanged in February, imports from the country declined 14.7 percent.
Advancing issues outnumbered decliners on the NYSE for a 2.76-to-1 ratio and on the Nasdaq for a 1.90-to-1 ratio.