BRUSSELS — President Trump on Thursday punctured any illusions that he was on a fence-mending tour of Europe, declining to explicitly endorse NATO’s mutual defense pledge and lashing out at fellow members for what he called their “chronic underpayments” to the alliance.

On a tense day when Mr. Trump brought the “America first” themes of his presidential campaign to the very heart of Europe, he left European leaders visibly unsettled, with some openly lamenting divisions with the United States on trade, climate and the best way to confront Russia.

The discord was palpable even in body language. When Mr. Trump greeted Emmanuel Macron, France’s new president, they grabbed each other’s hands, jaws clenched, in an extended grip that turned Mr. Trump’s knuckles white. When the leaders lined up to pose for the traditional photograph at NATO headquarters, Mr. Trump appeared to push aside the Montenegrin prime minister, Dusko Markovic, to get to his assigned place in the front.

The split was starkest at NATO headquarters, where Mr. Trump used the dedication of a soaring new building to lecture allies on their financial contributions. Far from robustly reaffirming NATO’s mutual defense commitment in the way that many members hoped he would, Mr. Trump repeated his complaint that the United States was shouldering an unfair burden.