Monday's rally got its start early after President Donald Trump said his negotiators had received encouraging calls from China on Sunday, though China's foreign ministry denied knowledge of any such calls.
That, nor the fact that the trade conflict has repeatedly seen both sides attempt to negotiate before ending in acrimony and more tariffs and trade penalties, did not dim investors' willingness to bid stocks higher.
Big technology companies, which do a lot of business in China and have much riding on the outcome of the trade dispute, accounted for a big share of the gains. Apple climbed 1.9% and Microsoft added 1.5%.
"It always seems that Trump, after he does something to freak the market out or escalate this trade war, he tries to dial it back to some degree," said Brad Bernstein, senior portfolio manager at UBS Wealth Management USA. "As an investor, you just have to know there's a lot of uncertainty and there is no clarity in the short term right now."
The S&P 500 rose 31.27 points, or 1.1%, to 2,878.38. The Dow Jones Industrial Average gained 269.93 points, or 1.1%, to 25,898.83. The Nasdaq, which is heavily weighted with technology stocks, rose 101.97 points, or 1.3%, to 7,853.74.
The Russell 2000 index of smaller companies picked up 16.52 points, or 1.1%, to 1,476. The major indexes are each on track for losses of 3% or more in August in what has been a volatile month for the market as investors try to gauge whether trade conflicts and slowing economies around the world will drag the U.S. into a recession.
Along the way, traders have been repeatedly whipsawed by the turns in the trade war between the world's biggest economies. The conflict escalated once again on Friday, after China announced new tariffs on $75 billion in U.S. goods. Trump responded angrily on Twitter, at one point saying he "hereby ordered" U.S. companies with operations in China to consider moving them to other countries, including the U.S.
Trump also later announced that the U.S. would increase existing tariffs on $250 billion in Chinese goods to 30% from 25%, and that new tariffs on another $300 billion of imports would be 15% instead of 10%.
The new round of tariff threats caused a sell-off on Friday that erased more than 600 points from the Dow. Global markets appeared headed for another wave of selling early Monday, when indexes in China closed sharply lower, until Trump said his trade negotiators had received two "very good calls" from China on Sunday.
During a press conference in France after the G7 meeting, the president said that "China wants to make a deal, and if we can, we will make a deal." Trump expressed his optimism about China hours after he sent mixed messages on the tariff war. He at first seemed to express regret Sunday over escalating the trade dispute, but the White House later said his only regret was that he didn't impose even higher tariffs on China.
The White House announced weeks ago that China's negotiating team was expected in Washington in September to continue the discussions. Ben Phillips, chief investment officer at EventShares, credited Monday's market bounce on investors buying back in after a big sell-off more than on real optimism over the long-running trade conflict.
"Every time you have a big down day like that you expect the following day to be a little bit of a recovery bounce that is more bouncing on the sell-off than it is on anything happening today," he said.
Analysts say investors should expect more sharp turns in the trade negotiations. "There's not a clear strategy on trade, that's what the market is coming to terms with," Phillips said. "That's what Friday showed us. The market is getting worried about emotions running high in the White House and less logic."
Communications services and health care stocks also contributed to Monday's gains. Dish Network climbed 3.9% and Bristol-Myers Squibb rose 3.3%. Bond prices fell, which sent the yield on the 10-year Treasury up to 1.54% from 1.52% late Friday. Higher yields push up interest rates on mortgages and other consumer loans, which helped drive bank shares higher. Bank of America gained 1.2%.
Major indexes in Germany and France closed higher. Markets in Britain were closed for a national holiday. Benchmark crude oil fell 53 cents to settle at $53.64 a barrel. Brent crude oil, the international standard, fell 64 cents to close at $58.70 a barrel. Wholesale gasoline fell 2 cents to $1.62 per gallon. Heating oil declined 3 cents to $1.79 per gallon. Natural gas rose 8 cents to $2.23 per 1,000 cubic feet.
Gold fell 30 cents to $1,526.30 per ounce, silver rose 22 cents to $17.62 per ounce and copper rose 1 cent to $2.54 per pound. The dollar rose to 106.19 Japanese yen from 105.31 yen on Friday. The euro weakened to $1.1098 from $1.1145.
AP Business Writer Yuri Kageyama contributed.