Trump showered his host with accolades during two days of meetings during which the US leader sought to convince Xi to do more to reduce a trade deficit with China and rein in nuclear-armed North Korea.
"My meetings with President Xi Jinping were very productive on both trade and the subject of North Korea," the US leader, who now heads to Vietnam for an Asia-Pacific summit, wrote on Twitter.
"He is a highly respected and powerful representative of his people. It was great being with him and Madame Peng Liyuan!" he said, referring to Xi's wife.
US and Chinese firms signed more than $250 billion in business deals during Trump's visit, though analysts say many were nonbinding agreements that could take years to show any results and would do little to reduce the US-China trade imbalance.
Trump again lambasted past US administrations for allowing the $350 billion deficit with China to balloon over the years.
"I don't blame China, I blame the incompetence of past Admins for allowing China to take advantage of the US on trade leading up to a point where the US is losing $100's of billions," he wrote.
"How can you blame China for taking advantage of people that had no clue? I would've done same!"
During their talks on Thursday, Trump thanked Xi for his backing of United Nations sanctions on Pyongyang and China's own restrictions on banking for North Koreans.
While Xi said China was committed to the denuclearisation of the Korean peninsula, he did not announce any new steps to squeeze the reclusive regime.
Xi and Trump have struck up a friendship since their first meeting at the former real estate tycoon's Mar-a-Lago resort in April.
Xi treated Trump to a lavish "state visit-plus" that included a private tour of the Forbidden City, a military honour guard and a banquet.
The US leader called his host a "very special man" and showed him a video of his granddaughter singing ballads in Mandarin.
Get Breaking news, live coverage, and Latest News from India and around the world on NDTV.com. Catch all the Live TV action on NDTV 24x7 and NDTV India. Like us on Facebook or follow us on Twitter and Instagram for latest news and live news updates.