Left-wing populist, Andres Manuel Lopez Obrador, has been elected president of Mexico with at least 53 per cent of the vote, the electoral authority says.
A projection based on a vote count in 7,800 representative polling stations confirms the victory of Lopez Obrador, National Electoral Institute President Lorenzo Cordova said.
Mr Obrador took between 53 and 53.8 per cent of the vote.
Conservative-centrist Ricardo Anaya received up to 22.8 per cent, while Jose Antonio Meade from outgoing President Enrique Pena Nieto’s Institutional Revolutionary Party (PRI) had up to 16.3 per cent.
The results make Mr Obrador Mexico’s first presidential candidate to receive more than 50 per cent of the vote since the PRI lost its dominant position in the last century.
“The revolution of consciences has triumphed,” the winner told tens of thousands of jubilant supporters who had gathered on Mexico City’s central Zocalo Square.
“I shall not let you down. You shall not be disappointed,” he vowed while crowds waved flags of his Morena party and chanted “President! President!”.
Voter turnout was estimated at 63 per cent of the 89 million eligible voters in the country’s biggest ever elections.
Among the 3,400 offices being contested were 500 seats in the Chamber of Deputies, 128 in the Senate, eight governorships and 1,600 mayoralties as well as other local positions.
Mr Morena was generally expected to do well.
Exit polls gave its candidate Claudia Sheinbaum as the new Mexico City mayor, while the party was also expected to win governorships in the states of Chiapas, Tabasco and Morelos.
Voters were seen as having punished the PRI for a string of corruption scandals, sluggish economic growth of only about 2 per cent and the party’s perceived inefficiency in combating the country’s soaring crime rate.
Pena Nieto, whose approval ratings stood at only about 20 per cent, was limited by the constitution to a single term.
Former Mexico City mayor, Obrador, who had already run for the presidency twice before, cast himself as an anti-establishment candidate prepared to crack down on corruption and to help the poor.
He has also pledged a less militarized, more social approach to fighting crime, including an amnesty to lower-level gang members.
Mexico recorded about 29,000 killings last year, the highest annual number since modern records started being kept two decades ago.
The electoral campaign was also overshadowed by violence, with about 120 politicians assassinated over 10 months, according to risk consultant Etellekt.
Criminal gangs committing such killings are believed to seek influence on politics especially on the local level.
A political killing was reported even on election day.
An activist of the Labour Party was shot dead on leaving her home in Contepec in western Michoacan state, the party was quoted as saying.
Lopez Obrador’s victory was expected by many to further worsen Mexico’s already frosty relations with the U.S., whose president, Donald Trump, has slammed the country over illegal migration and pressured it to pay for a border wall.
The president-elect said he would seek “a relationship of friendship and cooperation” with Mexico’s northern neighbour, but one based on “mutual respect.”
Mr Obrador was expected to be more assertive with Trump while seeking to reduce Mexico’s dependency on U.S. fuel and other trade.
Mr Trump tweeted that he looked “very much forward to working with” Obrador.
“There is much to be done that will benefit both the United States and Mexico!” the president added.
Bolivia’s leftist President Evo Morales tweeted: “We are sure that his government will write a new page on Latin America’s dignity and sovereignty’s.”
Mr Obrador has sought to placate fears that his victory would turn Mexico into another Venezuela, which is suffering a severe economic crisis under socialist rule.
In spite of lambasting the entrepreneurial elite as “a rapacious minority,” he has excluded the possibility of expropriations and pledged guarantees to investors.
Mr Obrador’s popularity is attributed less to his political programme than to a general desire to end the rule of the corruption-tarnished PRI, which has governed the country intermittently since 1929.