Veteran politician Andres Manuel Lopez Obrador wins after promising to tackle corruption and the drug cartels.
Veteran politician Andres Manuel Lopez Obrador has won Mexico's presidency in a landslide victory, giving the country its most left-wing government in decades.
The former Mexico City mayor won with the widest margin in a presidential election since the 1980s, according to an official quick count that showed him taking more than half the vote - some 30 points ahead of his nearest rival.
Pledging to eradicate corruption and subdue drug cartels with a less confrontational approach, Lopez Obrador will carry high expectations into office, while his efforts to reduce inequality will be watched closely by nervous investors.
Mexico is also enduring a prolonged wave of drug fuelled violence - by the end of this year it's predicted 30,000 will have been killed.
During the presidential campaign alone 130 people were killed.
"The new project of the nation will try to seek an authentic democracy, we're not trying to build a dictatorship, open or covert," he said, in a conciliatory speech promising central bank independence and economic prudence, along with respect for individual freedoms.
His government could usher in greater scrutiny of foreign investment and a less accommodating approach to the United States.
Investors are closely watching to see whether his MORENA party ends up with a majority in Congress, a result that would allow him more freedom to change economic policy.
In a posting on Twitter, Trump congratulated the leftist on his victory. "I look very much forward to working with him. There is much to be done that will benefit both the United States and Mexico!" Trump tweeted.
Earlier on Sunday, Trump raised the prospect of taxing cars imported from Mexico if there are tensions with the new government.
The United States, which has been at odds with Mexico and Canada over the renegotiation of the North American Free Trade Agreement has launched a probe into whether to slap tariffs on imported vehicles. Results are expected within months.
How Lopez Obrador handles relations with Trump, who has also sparred with Mexico over the U.S. president's call for a wall on the U.S.-Mexican border, will help define the new administration which will take office on Dec. 1.
Lopez Obrador, who hails from an impoverished part of Mexico where oil exploitation began, reiterated a vow to review for signs of corruption contracts issued to private energy firms under the current government.