China and the United States are rekindling trade talks ahead of a meeting next week between Presidents Donald Trump and Xi Jinping, cheering financial markets on hopes that an escalating trade war between the two countries would abate.


Trump said on Tuesday that teams from the two sides would begin preparations for the leaders to sit down at the G20 summit in Osaka. China, which previously declined to say whether the two leaders would meet, confirmed the get-together.


“Had a very good telephone conversation with President Xi of China. We will be having an extended meeting next week at the G-20 in Japan. Our respective teams will begin talks prior to our meeting,” Trump said in a post on Twitter.


The world’s two largest economies are in the middle of a costly trade dispute that has pressured financial markets and damaged the world economy.


Talks to reach a broad deal broke down last month after U.S. officials accused China of backing away from previously agreed commitments. Interaction between the two sides since then has been limited, and Trump has threatened, repeatedly, to slap more tariffs on Chinese products in an escalation that businesses in both countries want to avoid.


In a speech Tuesday night formally launching his 2020 re-election campaign, Trump said he had taken “historic action to confront China’s chronic trading abuses.”


“It should have been done a long time ago, but the days of stealing American jobs and American companies, American ideas and wealth - those days are over,” Trump told the packed rally in Orlando, Florida.


White House officials declined to go into detail about the preparations or expected outcomes of the talks in Japan, but both sides reiterated long-held positions: U.S. officials called for structural changes in the Chinese economy and in how Beijing treats U.S. businesses; China called for dialogue instead of expensive tariffs.


“The key is to show consideration to each other’s legitimate concerns,” Xi said, according to Chinese state media. “We also hope that the United States treats Chinese companies fairly. I agree that the economic and trade teams of the two countries will maintain communication on how to resolve differences.”


Washington has already imposed 25% tariffs on $250 billion of Chinese goods, ranging from semi-conductors to furniture, that are imported to the United States.


Trump has threatened to put tariffs on another $325 billion of goods, covering nearly all the remaining Chinese imports into the United States, including consumer products such as cellphones, computers and clothing.


Trump had made no secret that, despite his threat to escalate the dispute, he wanted to meet with Xi while they are both in Japan. China’s confirmation of the meeting avoids the possibility of a snub to Washington that could have triggered another round of tariffs.


Trump praised his relationship with Xi and spoke optimistically about getting a deal.


“I think we have a chance. I know that China wants to make a deal. They don’t like the tariffs, and a lot of companies are leaving China in order to avoid the tariffs,” he told reporters at the White House.


“I think the meeting might very well go well, and frankly our people are starting to deal as of tomorrow. The teams are starting to deal. So we’ll see. China would like to make a deal. We’d like to make a deal, but it has to be a good deal for everybody.”


Trump’s tweet offered fresh fuel to a rally on Wall Street as investors bet renewed talks could diffuse the trade war. The S&P 500 gained nearly 1%, while the Nasdaq and Dow Jones Industrial Average both gained around 1.4%. All closed at their highest levels since early May when Trump knocked global stock markets by ratcheting up tariff rates on $200 billion of imported Chinese goods.


“This is a very positive development,” said Clete Willems, a former trade negotiator with Trump’s team.


“Leader level engagement at last year’s G20 was critical to jumpstarting the talks,” he said, citing last year’s meeting between Xi and Trump at the G20 in Argentina. “It will be essential to managing the current political dynamic and getting the talks back on track once again.”


White House economic adviser Larry Kudlow declined to give details on how the two countries would prepare for the Xi-Trump meeting and said the United States would continue to press for China to change its practices on intellectual property theft and requirements that U.S. companies share their technology to do business in China.


“Our position will continue to be (that) we want structural changes. We want structural changes on all the items ... theft of IP, forced transfers of technology, cyber hacking. Of course trade barriers. We’ve got to have something that’s enforceable,” he told reporters at the White House.


The two sides were close to a deal in May that addressed many of those concerns. But China sought to soften the legal requirements in the text of the deal, and the United States balked.


According to Chinese state media, Xi told Trump that the China-U.S. relations had encountered difficulties. “If China and the United States cooperate, both benefit. If they fight, both get hurt,” state media paraphrased Xi as saying.


Beijing wants the United States to lift its tariffs, but U.S. Trade Representative Robert Lighthizer, who has spearheaded negotiations, said on Tuesday that talks alone were not enough.


“I don’t know if it will get them to stop cheating, tariffs alone. I think you don’t have any other option,” Lighthizer told a congressional hearing. “I know one thing that won’t work and that is talking to them. Because we’ve done that for 20 years.”