WASHINGTON — The fate of a yearlong trade war will reach a pivotal moment this weekend as President Donald Trump and President Xi Jinping of China meet in Japan. But while both leaders appear open to a truce, they have hardened their positions before the talks, leaving it unclear how the United States and China will resolve the tensions that have thrust the world's two largest economies into conflict.

Both leaders have an incentive to avoid a further escalation of a trade war that has battered companies and consumers on both sides of the Pacific. The global economy is weakening as a result of the trade war, with China and America feeling the effects, putting Trump's reelection and Xi's popularity at risk. But neither leader wants to be seen as capitulating or agreeing to concessions that could give them less leverage once trade talks resume.

"There are still big substantive issues to resolve," said Derek Scissors, a China expert at the American Enterprise Institute. "I don't know how you make a deal in the next year and a half that changes the direction of the U.S.-China relationship."

The United States and China appeared to be on the cusp of a trade agreement in April, only to have negotiations collapse in early May after the Chinese government rejected some of the Trump administration's demands. Tensions have only escalated since, with both sides ratcheting up tit-for-tat punishment, creating even more issues to resolve.

Trump raised tariffs on $250 billion worth of Chinese products and has moved forward with preparations to tax another $300 billion worth of Chinese goods. The U.S. has tried to cut off the telecom firm Huawei and other Chinese companies from buying American technological components over national security concerns, hamstringing prominent businesses.

In return, China has put its own higher tariffs in place on goods from the United States and threatened to draw up a blacklist of U.S. companies that it views as "unreliable."

The Trump administration says China must agree to a previous version of the pact, which would legally enshrine protections for intellectual property and require hundreds of billions of dollars of American products to be purchased every year.

Beijing has insisted that the deal must include lifting the tough U.S. sanctions on Huawei, along with removing all of Trump's tariffs and dropping any plans to impose more.

"The U.S. side threatens to implement additional tariffs on China, but it can't scare the Chinese people at all," Geng Shuang, the Foreign Ministry spokesman, said at a news briefing on Thursday in Beijing.

Even if Trump and Xi are able to strike a temporary cease-fire that would continue negotiations and forestall more tariffs, the meeting seems unlikely to produce the kind of transformative deal that Trump once promised.

China has balked at many of the Trump administration's requests, including changing its laws surrounding intellectual property and the treatment of data, and curtailing state subsidies to its firms. It has also made little headway in its demands that the Trump administration remove all of its tariffs. On Huawei, Trump has sent mixed messages, describing the company as a national security threat but also saying that its fate could be determined as part of a trade deal.

The president's top advisers are also divided, according to people familiar with the deliberations. Officials on the National Security Council, along with officials at the defense and intelligence agencies and Peter Navarro, a top trade adviser, have insisted that Huawei's punishment not be softened. But economic advisers — including Steven Mnuchin, Jared Kushner, Larry Kudlow and even Robert Lighthizer, the top trade negotiator — say they are wary of the threat from Huawei but believe that some concessions could be made in return for progress on the trade front.

The window for a substantive discussion may be brief. Xi and Trump are scheduled to have only a Saturday morning meeting in Osaka, Japan, and not the lengthy dinner they had at the previous Group of 20 summit, in December in Buenos Aires.

At that dinner, Xi and Trump reached a narrow, temporary truce in which China agreed to resume buying American soybeans and the United States delayed plans to increase tariffs to 25% from 10% on $200 billion worth of goods.

Similar threats of escalation — to move ahead with tariffs on a further $300 billion worth of Chinese goods — hang over the meeting in Osaka. In an interview on Wednesday, Trump said that he would welcome a deal with the Chinese, but that he was ready to proceed with more tariffs if negotiations between the countries did not progress. But he softened the threat by saying he might charge a tax of 10% on those goods, rather than 25%.

"It's possible we're going to make a deal, but I'm also very happy where we are now," the president said.

Trump also played down the economic toll his trade war is having on the United States and said China is eager to compromise.

"They want to make a deal more than I do," he said. "The Chinese economy's going down the tubes."

Some of the president's advisers have warned about the risk of a prolonged trade conflict and have tried to smooth the path to better relations in China in recent weeks.

A speech by Vice President Mike Pence that would have criticized China's human rights record was twice postponed this month, and the administration has paused an effort to blacklist Chinese companies that are involved in the surveillance and detention of a Chinese Muslim minority.

Some Trump administration officials have floated the idea of a six-month timeline to reach an agreement after the talks, though no consensus has been reached, according to one person familiar with the discussions.

China, too, has tried to increase its leverage. Xi announced a sudden visit to North Korea last week. Analysts said he could be trying to revive Trump's disarmament deal with the North in the hopes of delivering a plan for the next phase of the nuclear negotiations to Trump when they meet in Osaka.

Despite the tough statements, there is strong incentive in both countries to get talks back on track. In China, tariffs have piled on to the damaging effects of a sharp but temporary credit crunch last year, further weakening consumer confidence and growth in industrial production. Chinese consumers are seeing spiraling prices for products like pork and fruit. In the United States, the Federal Reserve has cited uncertainty surrounding trade policy as a threat to the economic expansion and a reason it may cut interest rates.

Many American manufacturers and retailers have been critical of the effect of the tariffs. In seven days of hearings that concluded on Tuesday, businesses including toymakers, book publishers and purveyors of fireworks testified that the tariffs would raise their costs and damage the health of their businesses.

U.S. farmers, a key source of support for the president in the 2020 election, have also been hit hard by Chinese retaliation. Farmers are "one of the casualties" of the trade war, Agriculture Secretary Sonny Perdue told CNN in an interview Tuesday. "I think a deal can be made, and it may be done quickly," he said.

Trump now faces a dilemma of whether it will be better politically to remain tough on China and risk further damage to the U.S. economy from the trade war or whether he should settle for a partial deal that could expose him to criticism of being weak on China.

There is a strong belief in China — both inside and outside the government — that Trump needs a deal more than Xi, given the 2020 election.

Andy Mok, a trade specialist at the Center for China and Globalization, a Beijing research group that supports government policies, said there was "a hope" in China "that the U.S. will show some flexibility."

"I think Trump is looking for a win to strengthen his chances in the election, but the trade war is also being understood by more sectors of the United States public," Mok said.

On Wednesday, in the first 2020 Democratic presidential primary debate, four of the 10 candidates onstage named China as the greatest geopolitical threat.

"President Trump needs to look strong," Joel Trachtman, a professor of international law at Tufts University's Fletcher School of Law and Diplomacy.

But removing tariffs that have harmed businesses and slowed the economy could also reduce the risk of a recession coming before the presidential election, he added.

"Which force is stronger — the political forces versus the economic forces?" Trachtman asked. "It's hard to say."