President Donald Trump directed officials to explore rejoining an Asia-Pacific trade pact he withdrew from shortly after taking office — if they can get a "substantially better" deal — and expressed optimism about a deal with China, a shift in tone that boosted sentiment in the markets.

A week after escalating tensions with his threat to impose tariffs on an additional $100 billion in Chinese products, Trump said Thursday the two countries ultimately may end up levying no new tariffs on each other.

“Now we’re really negotiating and I think they’re going to treat us really fairly,” Trump said during a White House meeting with Republican governors and lawmakers from farm states. “I think they want to.”

The remarks were another conciliatory signal from the administration following tit-for-tat tariffs proposals from the world’s largest two economies that rattled markets. Trump also indicated that talks are progressing toward successful renegotiation of the North American Free Trade Agreement.

Still, it’s unclear to what extent the comments represent an actual shift in policy. Trump later tweeted that he’d only join the TPP if it were "substantially better than the deal offered" to President Barack Obama. He also noted that the U.S. already had bilateral deals with six of the 11 nations in the agreement and was talking with Japan, "who has hit us hard on trade for years!"

Would only join TPP if the deal were substantially better than the deal offered to Pres. Obama. We already have BILATERAL deals with six of the eleven nations in TPP, and are working to make a deal with the biggest of those nations, Japan, who has hit us hard on trade for years! — Donald J. Trump (@realDonaldTrump) April 13, 2018

Japan, the biggest economy in the current agreement, welcomed the interest in rejoining the TPP but said that it wasn’t interested in partial renegotiation.

"If these comments mean that President Trump is correctly evaluating the significance and effects of the TPP, then we welcome them," said Toshimitsu Motegi, the minister in charge of TPP. "The deal is a balanced one, like fine glassware, and it would be extremely difficult to renegotiate or change just one part of it."

It’s important to check what Trump actually said, Finance Minister Taro Aso said. Trump is temperamental so "there may be a different statement the next day," he told reporters in Tokyo.

Vietnam would welcomes the U.S. rejoining the deal, according to a Vietnamese trade official, who said that it was designed to leave the door open for the U.S. to come back.

The S&P 500 Index closed up 0.8 percent and the Dow Jones Industrial Average added almost 300 points, or 1.2 percent, as investors assessed the changing trade dynamics. Asian stocks climbed as equities in Japan and Australia advanced.

Trump withdrew the U.S. from the accord during his first week in office. The pact, which was conceived as a counterweight to China’s rising economic power in the region, had been negotiated under the Obama administration but never approved by Congress.

Senator Ben Sasse, Nebraska Republican who participated in the meeting with Trump, said: "He multiple times reaffirmed the point that TPP might be easier to join now."

The news drew a rebuke from opponents of the multilateral trade pact. AFL-CIO President Richard Trumka, head of the main trade union group, said on Twitter that TPP “was killed because it failed America’s workers and it should remain dead.”

Democrat Senator Sherrod Brown, said he was “very open to a new TPP” as long as it had strong labor rights protections and currency provisions. “You’d need a whole renegotiation.”

The 11 remaining nations, representing 13 percent of global output including Japan and Canada, finalized a revised version of the trade pact last month, renaming it the Comprehensive and Progressive Agreement for Trans-Pacific Partnership or CPTPP.

One of the White House officials said that while the president prefers negotiating bilateral trade deals, a multilateral deal with the TPP countries would counter Chinese competition and would be faster than negotiating one-on-one with each of the 11 other nations.

Talks with China broke down last week after the Trump administration demanded steps to curtail China’s support for high-technology industries, a person familiar with the situation said.

In his remarks on Thursday, Trump cited a speech by Chinese President Xi Jinping that the he interpreted as a signal China is about to open its markets to more U.S. goods. “He’s going to get rid of a lot of taxes and tariffs,” Trump said of the Chinese leader.

Xi pledged a “new phase of opening up” Tuesday in a keynote address to the Boao Forum for Asia. While the speech offered little new policy and made no mention of Trump, Xi affirmed or expanded on proposals to increase imports, lower foreign-ownership limits on manufacturing and expand protection to intellectual property -- all issues central to the U.S. president’s trade complaints.

Trump clearly regarded the remarks as conciliatory, and said again Thursday that it was a “good speech.”

U.S. Commerce Secretary Wilbur Ross said the administration needs to see concrete actions from China to reach a deal.

On talks with Canada and Mexico to revamp Nafta, Trump said negotiations are “coming along great,” though he added there’s no timeline to reach a deal.