TOKYO -- It was a fresh sign of rapidly warming relations when Japanese Prime Minister Shinzo Abe made a surprise appearance at a gala hosted by the Chinese embassy in Tokyo on Sept. 28.

The party was held to celebrate China's Oct. 1 National Day and the 45th anniversary of the normalization of diplomatic ties between the two countries. More than 2,000 guests -- including Foreign Minister Taro Kono and Toshihiro Nikai, the secretary general of Abe's Liberal Democratic Party -- crowded into the Hotel New Otani's banquet hall.

One day earlier, Abe had dissolved the lower house, the more powerful of the Diet's two chambers, and called elections for Oct. 22. So the following evening the prime minister had to brave the rain to give a speech in the streets of Tokyo's Shibuya Ward before rushing off to the party.

Sino-Japanese relations have been strained since the autumn of 2012. Back then, a wave of anti-Japanese demonstrations swept across China, a reaction to the Japanese government's nationalization of the Senkaku Islands. Chinese call the uninhabited islets in the East China Sea the Diaoyu Islands. By either name, they have been a source of tension between the two neighbors for decades now.

On the same day of the gala, Abe and Chinese Premier Li Keqiang exchanged congratulatory messages; it was the first such exchange in 10 years.

There was another first when Abe got to the party. No Japanese prime minister had attended a Chinese embassy-hosted party for 15 years. Abe only penciled it into his schedule a few days earlier.

Hardliner no more

During the party, Japanese government and ruling coalition leaders took turns on stage, giving speeches that painted rosy pictures of Sino-Japanese relations.

At the outset of his speech, Abe greeted the other guests with a "wan shang hao," Chinese for "good evening," as if he were trying to erase his image as a hard-liner toward China. Abe then expressed a strong desire to further improve Sino-Japanese relations through top-level contacts.

The prime minister specifically said he wants to host a summit of leaders from Japan, China and South Korea by the end of this year and that he would like Li to attend.

Should that summit come to pass, it would then be "my turn to visit China," Abe said. "After that, I want (Chinese) President Xi Jinping to visit Japan."

Riot police use shields as they guard the entrance to the Japanese embassy during a protest in Beijing in September 2012. © Reuters

Even though the elections pose a hurdle, Abe's speech got party guests talking about the strong likelihood of a trilateral summit at the end of this year.

Japan initially proposed holding the summit in July. At the time, though, China was in wait-and-see mode ahead of the Chinese Communist Party's national congress, set to kick off on Oct. 18. A big leadership shakeup will take place at the twice-a-decade congress.

The Chinese leadership was also looking at Abe's weakened position due to the string of scandals, which alleged that the Prime Minister's friends received favorable treatment while setting up schools.

Meanwhile, Foreign Minister Kono is also exploring the possibility of visiting China in November. Beijing appears agreeable to this.

These good tidings have largely gone unnoticed by the Japanese public as it pays attention to the upcoming elections and the political rise of Tokyo Gov. Yuriko Koike.

Ties began to improve in mid-May during an international conference in Beijing called to discuss China's "Belt and Road" initiative, which envisions modern-day Silk Road trading routes.

Takaya Imai, Abe's executive secretary and one of his closest confidants, joined the Japanese delegation and secretly met with Yang Jiechi, a state councilor who guides China's foreign policy. Yang later visited Japan.

In early June, Abe delivered a lecture at the Future of Asia conference, sponsored by Nikkei Inc., and made clear Japan's readiness to cooperate with China's Silk Road initiative.

In July, Abe held his fifth meeting with Xi, in Germany, on the sidelines of a summit of leaders from the Group of 20 major economies.

On Japan's political front, Abe took a big gamble by dissolving the lower house. He rolled the dice in the hopes of turning around his political fortunes and putting the brakes on his declining approval rating.

The prime minister's bid to repair ties with Japan's communist-ruled neighbor will not directly help his conservative Liberal Democratic Party win more votes in the elections. But the government's recent flurry of diplomacy toward China will nevertheless benefit Abe. It could help to defuse the escalating brinkmanship between North Korea and the U.S. over Pyongyang's nuclear and missile programs. China, after all, is North Korea's traditional ally and largest trading partner. The diplomatic niceties could also cheer corporate Japan. China is the world's second-largest economy in terms of gross domestic product.

No choice but to mend fences

China has an even more pressing reason to warm up to Japan. The country's diplomacy seems to be getting more tangled by the day.

The country's relationship with the U.S. remains strained. China's links to other countries are also deteriorating.

North Korea is becoming increasingly unruly in its defiance of the international community and of its largest trading partner. Furthermore, the until-recently cozy relationship between China and South Korea is now nowhere to be seen. South Korea's deployment of the U.S. military's Terminal High Altitude Area Defense, or THAAD, has angered China, which sees the system as a threat to its own security.

In July, Mongolia's presidential election saw the victory of then opposition candidate Khaltmaa Battulga, who has called for reducing the landlocked country's dependence on China.

Sino-Mongolia relations began deteriorating last November, when the Dalai Lama, Tibet's spiritual leader, visited Mongolia. China's government considers the Dalai Lama a dangerous separatist.

Despite some signs of fence-mending, the outcome of the presidential vote has left the future of Sino-Mongolia ties in uncertain territory.

The list of China's diplomatic complications goes on. Chinese and Indian troops this summer got into a tense two-month standoff on the Doklam plateau -- a disputed area between Bhutan and China that is also of strategic importance to India.

Differences have also emerged between China and Singapore over South China Sea claims and other matters. And Singapore is about to gain some regional sway. Next year, it will hold the rotating presidency of the 10-member Association of Southeast Asian Nations.

China's claims of the South China Sea has pitted it against several ASEAN members, who are disturbed that China has been building artificial islands in the body of water and erecting military facilities on the newly created real estate.

Then there is Taiwan, where President Tsai Ing-wen has named William Lai as premier. Lai is a popular politician and member of Tsai's pro-independence Democratic Progressive Party. In the past he has declared, "I am a politician advocating Taiwan's independence."

Beijing still regards Taiwan as a renegade province that must be reunified with the mainland, by force if necessary, and has pressured the Taiwanese president to acknowledge the "One China" principle.

All these diplomatic imbroglios have given Beijing no choice but to try to mend some fences. In this regard, Beijing has tried to subtly woo Japan, which China needs for its own sustained economic development.

The color purple

China has also signaled a desire for better ties with the U.S.

Shortly before Abe appeared at the Tokyo party on Sept. 28, President Donald Trump's daughter Ivanka Trump and her husband Jared Kushner showed up at the Chinese embassy in Washington to celebrate China's National Day.

The power couple had canceled a visit to China in September. But by attending the party, the pair allowed China to save face.

They likely attended at President Trump's behest.

State-run CCTV footage shows Chinese President Xi Jinping visiting the Beijing Exhibition Center to take in an exhibition showcasing his accomplishments as party general secretary on Sept. 25.

Shortly after the Washington party, U.S. Secretary of State Rex Tillerson arrived in Beijing for hastily arranged talks with Xi. The two discussed the pressing North Korea problem and laid the groundwork for Trump to visit China next month.

In another diplomatic entreaty, Wang Qishan, Xi's right-hand man, played a key role. Singaporean Prime Minister Lee Hsien Loong received an invitation to Beijing so China could attempt to put its relations with the city-state back on track. The visit took place in the second half of September.

Wang is a Politburo Standing Committee member and China's chief graft-buster. The seven-member committee is the Chinese Communist Party's top decision-making body. It is led by Xi, who doubles as the party's general secretary.

Wang's fate will be a focal point at the national congress, where a majority of the standing committee members are to retire and be replaced. Wang is older than the traditional retirement age but could stay on.

Wang, as the anti-corruption chief, does not usually attend ceremonial talks with foreign dignitaries. But this time he met with the Singaporean prime minister at Zi Guang Ge, the Hall of Purple Light, in Beijing's Zhongnanhai district, an enclave populated by Chinese leaders.

"A hidden sign"

Singapore media gave detailed reports of what Wang and Lee discussed.

At the outset of their talks, Wang said he was surprised by but happy with Lee's request to meet him. "So I sought permission and I am here meeting you and your delegation today," Wang was quoted as saying.

Meanwhile, Lee was quoted as saying, "We are very honored to be here just before the 19th Party Congress. ... We know it's a very busy time for you and for all your colleagues, and we're very appreciative that you are spending time."

The exchange of words has political significance. It suggests that Wang is now playing an important role in arranging the national congress.

Wang is 69. If the unofficial party retirement age of 68 is applied to him, the veteran politician will bow out of politics during the national congress.

But Lee does not think Wang will completely retire. He requested the meeting with Wang because he believed it would benefit his country in the future.

State-run CCTV footage shows Wang Qishan, right, China's anti-corruption czar, holding talks with Singaporean Prime Minister Lee Hsien Loong at Zi Guang Ge, the Hall of Purple Light, in Beijing's Zhongnanhai area, on Sept. 20.

The Hall of Purple Light is primarily used by China's premier to receive foreign dignitaries. Footage from state-run China Central Television, or CCTV, shows Wang wearing a purple tie during his meeting with Lee.

In China, purple is believed to be a noble color. The buildings in Zhongnanhai have their names inscribed on horizontal boards. The base color of most of these boards, including that of Zi Guang Ge, is purple.

Political watchers in Beijing believe Wang's purple tie must be "a hidden sign" of his intention to remain in Zhongnanhai as one of China's leaders after the national congress.

Surviving October

While Xi seeks to cement his hold on China this month, Japan's Abe is facing a crucial electoral test.

A look back on the past history of Sino-Japanese relations shows that China has often adopted a hard-line stance toward Japan when its regime's power base is unstable or when the Communist Party stands divided. Such was the case back in 2012, when ties frayed over those islets in the East China Sea.

The fact that Xi's regime has now signaled its desire for warmer relations with Japan can be seen as a sign that the president and party general secretary is securely in control of China.

Yet Sino-Japanese relations could be cast in a new light depending on the results of the Japanese elections.

Abe will not be able to host his envisioned Japan, China, South Korea trilateral summit at the end of this year if his LDP suffers a crushing defeat and he is forced to step down. Even if Abe survives the elections, Beijing will not take him seriously if his ruling coalition loses too many seats.

Meanwhile, it is also unclear whether Xi will be able to stack the Politburo Standing Committee as he wants during the national congress.

The Xi-Abe rapprochement is a fragile one.