The note signalled a possible improvement in their strained relationships, which has soured over Pyongyang's growing weapons ambitions even though Beijing is its longtime ally and economic benefactor.
Xi's message, dated yesterday, was sent in response to congratulations from Kim last week for securing a second term as the head of China's ruling party.
"I wish that under the new situation the Chinese side would make efforts with the Democratic People's Republic of Korea (DPRK) side to promote the relations between the two parties and the two countries to sustainable soundness and stable development," Xi said, according to the
North Korea's KCNA news agency said, addressing Kim as "Comrade Chairman".
In his earlier note, Kim had offered Xi his "sincere congratulations" and expressed his belief that their relations would develop "in the interests of the people of the two countries".
The last time KCNA reported a message from Xi was in July 2016.
Analysts say that such exchanges have become extremely rare under the current leaders, even though Beijing and Pyongyang traditionally sent greetings and congratulations on each other's key anniversaries in the past.
Mao described the allies as close as "lips and teeth", and China has long been accused of failing to enforce United Nations sanctions against the North for its banned nuclear weapons and ballistic missile programmes, even after voting for them in the Security Council.
But Beijing has grown increasingly frustrated by its belligerent neighbour, and rapidly backed a new set of UN measures after a flurry of missile launches by the North Korea and its sixth nuclear test in September.
Professor Yang Moo-Jin of the University of North Korean Studies in Seoul said the public exchange of messages signalled a willingness on both sides to improve relations.
"The fact that both sides are swiftly trading letters and announcing it carries a symbolic meaning," Yang told AFP.
"If the message was more intimate, we could expect a faster thawing of ties," he added, "but for now, it shows that both sides agree on the need to improve their relations".
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)