The Chinese yuan strengthened after the country's top banking officials said they wouldn't push to devalue the currency in retaliation for trade tariffs threatened by U.S. President Donald Trump.

The yuan appreciated by 0.4% to 6.64 per U.S. dollar on Tuesday. In June, the currency weakened by 3.5%, its worst month in more than 20 years.

President Donald Trump's escalating trade tiff with China has stoked investor concerns that the country might seek to devalue its currency, a fear that last gripped global markets and sent stocks reeling in 2015 and 2016.

But on Tuesday, People's Bank of China Governor Yi Gang said the country would "keep the yuan exchange rate basically stable at a reasonable and balanced level," Bloomberg News reported. A separate official at the central bank said separately that the currency's recent slide was due to market forces rather than a concerted push for a weaker rate. 

The yuan's drop has rattled traders, recalling memories of the China's sudden devaluation in August 2015, which sent U.S. stocks down 6.3% that month.

Win Thin, head of emerging-markets strategy at the brokerage firm Brown Brothers Harriman, said that the country's officials probably don't want to spook markets with a devaluation, since it could trigger capital outflows by investors, further exacerbating the pressures on the currency.

"I don't think they want to go down that road again, especially since the global economy is much more uncertain now than it was three years ago," Thin said. 

Economists have warned that China, which closely manages its foreign exchange rate, could allow or encourage a steep drop in the value of the yuan as a way of retaliating against Trump's threatened tariffs. A cheaper currency for China would help to offset the effect of any tariffs on its exports to the U.S. by helping to keep the end products affordable for consumers.

Meanwhile, the Federal Reserve's interest-rate increases in recent years have helped to make U.S. investments incrementally more attractive, pushing up the value of the dollar while weakening often-volatile emerging-market currencies.

"This recent yuan weakness is really just catch-up with EM weakening," Thin said. 

Brown Brothers Harriman estimates the yuan will weaken further to 6.8 per dollar by the middle of 2019.