Donald Trump and Xi Jinping have agreed to a new ceasefire in a yearlong trade war between the US and China during their meeting on Saturday at the G20 conference in Japan.

Mr Trump said he had agreed with the Chinese president the US would refrain from raising tariffs on China’s imports for now while Beijing would buy more US agricultural products.

“We’re holding back on tariffs and they’re going to buy farm products,” Mr Trump told a news conference at the end of a two-day summit in Osaka, claiming relations were “right back on track”.

Mr Trump also said US companies can again sell products to the Chinese technology giant Huawei after an effective ban introduced in May. “We send and we sell to Huawei a tremendous amount of product that goes into the various things they make,” he said.

“I said, ‘That’s OK that we will keep selling that product.’ I’ve agreed to allow them to continue to sell that product so American companies will continue.”

When asked whether Huawei would be formally removed from a US Commerce Department list of companies considered to undermines US national security, Mr Trump said that it would be discussed at “the very end” of trade talks. “We’re not discussing that with President Xi yet,” he said.

Xinhua, the Chinese state-run news agency, confirmed the leaders had agreed that stalled trade talks would resume and that the US would hold off on threatened additional tariffs on Chinese goods.

After posing for photographs with his counterpart at the sidelines of the G20, Mr Xi recounted the era of “ping-pong diplomacy” that helped jump-start US-China relations two generations ago.

Since then, he said, “one basic fact remains unchanged: China and the United States both benefit from cooperation and lose in confrontation ... Cooperation and dialogue are better than friction and confrontation.”

Donald Trump speaks during a news conference in Osaka (AP)

The US president had recently threatened to impose tariffs on an additional $300bn (£236bn) in Chinese imports – on top of the $250bn in goods he has already taxed – extending his import taxes to virtually everything China ships to the US.

He has said the new tariffs, which are paid by US importers and usually passed onto consumers, might start at 10 per cent. Earlier, the administration had said additional tariffs might reach 25 per cent.

The two countries have been sparring over the Trump administration’s allegations that Beijing steals technology and coerces foreign companies into handing over trade secrets. China denies it engages in such practices.

The US has also tried to rally other nations to block Huawei from their upcoming 5G systems, branding the company a national security threat and barring it from buying US technology until Mr Trump’s announcement on Saturday.

Under the newly agreed ceasefire scenario, existing tariffs and counter-tariffs on many of each other’s goods would remain in place. But no additional import taxes would take effect. This would buy time for US and Chinese officials to restart talks that stalled last month.

Mr Trump said talks with Mr Xi went “probably even better than expected” and claimed the leaders enjoyed “an excellent relationship”.