TOKYO — Standing at side-by-side lecterns inside the gilded Akasaka State Guest House in Tokyo, President Trump and Prime Minister Shinzo Abe of Japan sought to show the world the strength of what Mr. Abe called their “unshakable bond.”

The joint news conference that followed made it clear that being in lock step with Mr. Trump can be a precarious position for any world leader.

After the two men strode to the podium on Monday afternoon, Mr. Abe declared that the friendship and alliance had been further cemented by a day on the golf course, inside the sumo arena and at a robatayaki dinner with their spouses. He said that he and Mr. Trump were “completely on the same page” on issues like trade and North Korea.

But Mr. Trump, after praising Japan’s hospitality and ancient culture, as well as Mr. Abe’s friendship, made it clear that he was there to put America, and in some cases his own grievances, first.