Mexico’s president-elect said he will push to keep Canada in the North American Free Trade Agreement, as Mexican officials scrambled to try to broker a last-minute deal between Washington and Ottawa.

“There is still time to achieve a trilateral agreement,” Mexican President-elect Andrés Manuel López Obrador said Friday after speaking with Canadian Prime Minister Justin Trudeau.

Mr....