On his first trip abroad since taking power, Kim and his wife were met with honour guards and a banquet hosted by Xi, according to state media, which confirmed the "unofficial" visit on Wednesday only after Kim had returned to North Korea.
The two men held talks at the stately Great Hall of the People during which they hailed their nations' historic relations, with Kim pledging that he was "committed to denuclearisation" on the Korean peninsula, according to China's Xinhua news agency.
"There is no question that my first foreign visit would be to the Chinese capital,"Kim said, according to North Korea's official KCNA news agency.
"This is my solemn duty as someone who should value and continue the DPRK-PRC relations through generations."