BEIJING (Reuters) - China on Thursday praised the tone of this week’s visit to Beijing by U.S. Defense Secretary Jim Mattis, saying it had achieve positive results and that Chinese Defence Minister Wei Fenghe would go to Washington this year.

China's Defense Minister Wei Fenghe and U.S. Defense Secretary Jim Mattis review an honor guard during a welcome ceremony at the Bayi Building in Beijing, Wednesday, June 27, 2018. Mark Schiefelbein/Pool via Reuters

Mattis, the first U.S. defense chief to come to China in four years, has described his talks as “very, very good”, even as President Xi Jinping told him China would not give up an inch of its territory, likely a reference to the disputed South China Sea and self-ruled Taiwan which China claims.

Mattis was in China at a time of high tension between Washington and Beijing over trade, the South China Sea and Taiwan.

But speaking at a monthly news briefing, Chinese Defence Ministry spokesman Wu Qian said the two countries had reached an “important consensus” on mutual trust, further exchanges, cooperation and managing and controlling risks and challenges.

“The visit achieved positive, constructive outcomes,” Wu said.

He added that Defence Minister Wei has accepted an invitation from Mattis to visit the United States this year.

Their relationship has been tested in recent months. In May, the Pentagon withdrew an invitation to China to join a multinational naval exercise, citing China’s military moves in the South China Sea. The U.S. decision upset Beijing and was raised during Mattis’ talks, officials said.

Mattis has previously made strong public remarks about what Washington views as the Chinese militarization of the South China Sea.

In an editorial, the official China Daily noted the more positive tone from Mattis, but said it would be silly to expect his brief trip to resolve all their problems.

“The fact that the two militaries are willing to maintain open and honest dialogue speaks of the resilience and maturity of the two countries’ military-to-military relations, which are critical to the broader Sino-U.S. relationship and to control risks,” the state-run English-language paper said in an editorial.

Mattis struck the right note telling Xi the two countries attach the same importance to their military ties, it added.

“But this perspective is not the general approach the U.S. has taken to relations under the presidency of Donald Trump, and for the two countries to continue to build on their common ground the U.S. must also treasure the relationship and match such words with actions.”