Investors flipped back into buying mode Tuesday after the United States said it would hold off on tariffs of Chinese imports of mobile phones, toys, and several other items typically on holiday shopping lists. China also said the two sides held discussions on trade overnight and would talk again the next two weeks. The latest turn in the US-China trade war helped the market make up much of the losses from the previous two days, snapping a two-day losing streak for the S&P 500. ‘‘Maybe today is a little bit too exaggerated because it was a little glimmer of hope about tariffs,’’ said Karyn Cavanaugh, senior markets strategist at Voya Investment Management. ‘‘However, the drama with China and trade is not over.’’ Retailers were some of Tuesday’s best performers because the delay in tariffs means they won’t have to raise prices on toys, clothing, and other items during the holiday shopping season, the most important months of the year for the industry. Best Buy jumped 6.5 percent, one of the biggest gains in the S&P 500, and Dollar Tree rose 4 percent for its best day since March. Other companies that have a lot riding on strong holiday sales, as well as a dependence on China for producing their goods, were also among the market’s leaders. Apple climbed 4.2 percent, Micron Technology added 4.8 percent, and Hasbro gained 2.7 percent.