At the Chinese Communist Party Congress two weeks ago, Xi shored up his absolute control over Chinese politics and pledged to oversee the country's rejuvenation and return to great power status.
Trump's visit gave Xi the chance to demonstrate Chinese power and prestige like never before.
Unlike previous stops in Japan and South Korea -- where Trump boasted of US military strength, instructed the country's leaders how many weapons they were to buy, and received ebullient praise from them in return -- the China trip was much more a meeting of equals.
The US President even updated his Twitter profile page to prominently feature a photo of him and Xi at the Forbidden City.
At a joint speech with Xi, Trump heaped further praise on the Chinese leader, saying his people were "very proud" of him and hailing the "very good chemistry between the two of us." Xi was less generous in his praise, thanking Trump but stopping short of personal compliments.
While the greeting laid on for him obviously impressed Trump, he was also able to charm Xi and his wife, showing them videos of his granddaughter, Arabella, singing in Mandarin. The same video was played at a state dinner on Thursday and was shared widely on Chinese social media.
Positive reception
Unlike both of President Obama's trips to China, Trump's went without major incident.
Obama's relationship to China was focused around his "pivot to Asia," as well as strong opposition from Washington to Chinese expansion in the South China Sea.
The South China Sea was barely mentioned by Trump or Xi, with the Chinese President only appearing to reference the matter obliquely, highlighting the importance of respect for "territorial sovereignty."
"The Pacific Ocean is big enough to accommodate both China and the US," Xi added. Later, US Secretary of State Rex Tillerson told reporters Trump and Xi had "frank, open and productive" discussions behind closed doors which covered disputes in the South China Sea.
The Chinese media was delighted with Trump's trip, with an analyst on state-run broadcaster CCTV saying the US President "has given China what China wants, which is that respect on the global stage, as the other preeminent nation."
Global Times, a state-run tabloid known for nationalistic editorials, said Trump "seems to be pragmatic on his Beijing policy, and has no interest in ideological diplomacy."
It criticized the US media, a frequent target for Trump himself, for "absurd reports (which) deeply influenced Chinese public opinion," adding "it wasn't until his election victory that the Chinese public realized they had been cheated by the American media."
Limited gains
The US President's language about China is a far cry from that of candidate Trump, who was highly critical of Beijing's trade and economic policies.
Trump had played up his experience in deal making and promised to deliver economic wins from China. While he did succeed in signing more than $250 billion in trade agreements, analysts were skeptical of the gains made.
"President Trump got a number of tweetable concessions, but none of which significantly changed the nature of the relationship," said Nick Marro, China analyst at the Economist Intelligence Unit (EIU).
"Presidential visits have historically secured policy changes, and so this visit was somewhat of a missed opportunity. China was able to resist further market access openings, which is disappointing for the foreign business community."
He added it was unclear how much of the $250 billion in deals "were a result of the visit, or repackaged as part of the outcomes for political purposes."
Jacob Parker, Beijing-based vice president of the US-China Business Council, said he was "encouraged to see (Trump's) focus on leveling the playing field for foreign companies here."
"Unfortunately, we've heard this rhetoric before (from both sides)," he added. "Only in the next couple of months will we be able to determine what the follow up actions might be."
What criticism Trump did have for China on trade imbalances was undercut by his highlighting the cause as US policy, not Chinese.
"I don't blame China, who can blame a country for being able to take advantage of another country for the benefit of its citizens," he said. "I give China great credit."
Korea crisis
The ongoing North Korea crisis has dominated Trump's Asia trip, with the President harshly criticizing Pyongyang repeatedly.
But once tough language on China's role in the crisis -- Beijing remains Pyongyang's only real ally and multiple US administrations have called on it to do more to rein in its neighbor -- has been replaced by a more conciliatory, bridge-building approach.
At a press conference with South Korean President Moon Jae-in, Trump said Xi "has been very helpful" on the North Korean issue.
Speaking alongside Xi Thursday, Trump said "China can fix (the North Korea) problem easily and quickly."
"I am calling on China and your great President to hopefully work on it very hard," he added. "I know one thing about your President, if he works on it hard, he will make it happen."
Marro, the EIU analyst, said the "most significant Chinese concession on North Korea would have been a pledge for China to end its crude oil exports to the regime, but so far this remains unlikely."
"The fact that both leaders only vaguely agreed that a 'solution exists' indicates that they have not yet been able to come to a strategic consensus," he said.
Xie Tao, a professor of political science at the Beijing Foreign Studies University, said Trump "seems to have been putting almost all his eggs in one Chinese basket when it comes to North Korea."
"Finally maybe the idea has dawned on him that there is only so much that China can do and is willing to do," he said.
But while a relaxing of US pressure on China to act against North Korea could be seen as a win for Beijing, Xie warned it could result in Washington being more forceful on other issues it may be holding back currently.
"If Trump decides China is no longer such a pivotal player in resolving the North Korea issue then that relationship could have a downturn," he said.
Great power relations
Prior to the trip, much attention had been paid to Xi's apparent consolidation of power in the wake of China's Party Congress.
In contrast, Trump landed in Beijing amid historically low approval ratings and under the shadow of the Russia probe.
Not that the US leader is ready to step aside as the world's most powerful man.
When the President was asked by reporters prior to his trip what he thought about the remarkable run Xi is currently enjoying, he offered a quick retort.
"At this moment it's very tempting to see the two leaders in a very dramatically different position, both domestically and internationally," said Xie Tao of Beijing Foreign Studies University, adding that he advised against reading too much into public statements.
Regardless of their individual power, the two Presidents' relationship does seem to be genuinely strong: Trump's tone on China softened significantly after he established regular contact with Xi.
"Every time we've seen the leaders meet, the relationship has rebounded into positive territory," Marro said. "But personal relationships have their limits, and there's enough tension with trade investigations and North Korea that there's still a risk that relations will deteriorate."
Xie agreed, saying "what we're seeing now is more a sign of personal rapport."
"But I would not really put a lot of bets on significant improvement of (the US-China) relationship," he added. "There are many structural factors that put the relationship under very strong stress."