WASHINGTON — President Trump reached out to Mexico’s new populist president-elect on Monday in an early, but potentially short-lived, show of détente, saying the two leaders engaged in a “good conversation” about border security and the North American Free Trade Agreement.

The two countries remain locked in a heated dispute over the fraught issues of immigration and trade, areas that may face difficult complications from the election of Andrés Manuel López Obrador, a leader known for being as strong-headed and nationalist-minded as Mr. Trump — and just as willing to engage in a public clash of ideas.

Mr. López Obrador, who has said Mexico will not be a “piñata” for foreign governments, has said he will stand up to Mr. Trump to protect his country’s interests. And he may find himself under pressure by an electorate that, weary of Mr. Trump’s hectoring and disparaging comments about Mexico, will demand that he cede no ground, leaving little room to manage the relationship.

“There are going to be so many opportunities for this to go wrong,” said Duncan Wood, the director of the Wilson Center’s Mexico Institute. “If there are too many provocations, if there are too many insults against Mexico, López Obrador will not be able to just sit back and take it. His character shows that he will respond, and that could lead us down a dark path.”