WASHINGTON—Months of tensions, threats and volatile trade talks between the U.S. and Mexico ended not with the conventional handshake, but instead with a virtual embrace.

“I’m extending you an affectionate hug,” Mexico’s President Enrique Peña Nieto told President Trump by telephone on Monday as the White House unveiled the framework of a...