OSAKA -- Chinese President Xi Jinping and Japanese Prime Minister Shinzo Abe agreed to push bilateral relations into a new phase over a one-hour meeting on Thursday, reflecting a cozy relationship that has emerged unexpectedly as a byproduct of the U.S.-China trade tensions.

The two Asian leaders agreed to cooperate on promoting "free and fair trade" ahead of the two-day Group of 20 leaders summit that begins here Friday.

"We would like to welcome President Xi as a state guest around the time of the cherry blossoms next spring and wish to take Japan-China relations to a higher level," Abe said at the beginning of the meeting.

"I thank the prime minister for the warm invitation. I, too, think that a state visit next spring is a good idea," Xi responded.

According to a Japanese government briefing, Xi and Abe acknowledged that their countries are "forever neighbors" and should increase mutual visits by leaders.

This was Xi's first trip to Japan as China's president, though he visited as vice president in 2009. Hu Jintao was the last Chinese leader to visit Japan in 2010.

"This G-20 summit takes place amid a complex global situation," Xi told Abe, apparently referring to the U.S.-China trade war. "It has therefore special significance and is closely watched by people around the world."

Xi proposed that Japan and China have "close communications on various challenges and forge a common understanding." He called for the two countries to work together to "maintain a free trade system" and "give predictability and fresh energy to the global economy."

Abe concurred, but urged Xi to ensure that trade takes place on a sustainable basis by refraining from forced technology transfers or the provision of subsidies to industries. The Japanese leader also stressed that trade disputes need to be resolved through dialogue.

Xi's overture to Abe appears driven by the U.S.-China trade war. Knowing that Japan is also under pressure from President Donald Trump to reduce its trade imbalance with the U.S., Xi has tapped free trade as an umbrella that China and Japan can join hands under.

But Abe is in a difficult position. When Trump visited Japan in May, the American leader spent much of their bilateral meeting talking about how China had received too much of a good ride, sources say. Abe's warming to Xi will always be with one eye on Trump.

Their latest meeting follows a visit to Beijing by Abe in October, the first official visit to that country by a Japanese leader in seven years. The two nations agreed then to work together toward improving infrastructure in developing countries, as Beijing spearheads its Belt and Road Initiative of connecting with other countries through infrastructure projects, while Tokyo puts forward a vision of an open and free Indo-Pacific region.

Xi and Abe met again in December on the sidelines of the G-20 summit in Argentina, reaffirming their pledge to make reciprocal visits every year.

Ties between Japan and China have long been marred by historical issues as well as mutual rivalry and mistrust. The two countries remain in a standoff over the Japanese-controlled Senkaku Islands in the East China Sea, which China claims and calls the Diaoyu islands.

China's surpassing Japan to become the world's second-largest economy in 2010 added to the rivalry. Tokyo also became alarmed when Beijing tried to expand control over the South China Sea, a key shipping lane for Japan.

Yet relations have thawed in recent years as tensions have grown between Beijing and Washington. As the U.S. builds barriers to block the Chinese acquisition of American companies or technology, China has begun to turn to Japan for partnership.

Japan also needs access to China's growing economy to maintain its own economic growth amid an aging and declining population.

In a sign of deepening economic ties, the two countries started mutual listing of exchange-traded funds on each other's stock exchanges this week, creating more opportunities to invest in each other's markets. MUFG Bank is expected to be designated by Beijing as the first Japanese yuan-clearing bank, a move that aids Japanese investment in and trade with China.

Xi briefed Abe about his meeting last week with North Korean leader Kim Jong Un in Pyongyang, the first visit in 14 years by a Chinese leader to the reclusive state.

Abe has said he would meet face to face with Kim to resolve outstanding issues such as the Japanese abductees in North Korea and pave the way for diplomatic normalization between the two countries. Xi said he conveyed the prime minister's proposal to Kim.

Abe and Xi agreed that U.N. Security Council resolutions against Pyongyang should be implemented fully and that their two countries will work together toward achieving denuclearization of the Korean Peninsula.