TOKYO — Prime Minister Shinzo Abe of Japan is in Beijing for a three-day visit, the first Japanese leader to make an official trip to China in nearly seven years. The visit represents a chance to move beyond the tense relations between the two countries in recent years and their history of hostilities. Mr. Abe reached trade deals with China and committed to stable relations in a day of meetings Friday with President Xi Jinping and Premier Li Keqiang.

Why is the visit so significant?

Japan and China have a bitter and bloody history dating back to World War II, but have slowly warmed up to each other. The nascent rapprochement comes after several years of friction, including a tense period of Cold War style escalation between ships when the countries contested their claims to islands in the East China Sea.

The visit also comes at a time of shifting power dynamics around the Pacific Rim. President Trump is distancing himself from traditional allies, diplomacy is stalling around the effort to denuclearize North Korea and both China and Japan are seeking to curry favor with Southeast Asian countries.

China is Japan’s largest trading partner, and as China fights an escalating trade war with the United States and Japan prepares for what could be tense two-way trade talks with the United States early next year, Mr. Abe is keen to emphasize an open trading relationship with China. As Japan worries about the prospect of American tariffs on its auto exports, it is looking to further develop car sales in China. According to Japanese media, Toyota plans to increase its production in China and expand plants in two major Chinese cities.