Leftist populist Andres Manuel Lopez Obrador has won the Mexican elections with at least 53 per cent of the vote, according to official results.
Exit polls have given him an overwhelming lead and both of his chief rivals conceded defeat.
Lopez Obrador, who has vowed to transform Mexico and oust the "mafia of power" that rules the country, had a 16 to 26 point lead over his nearest rival, conservative Ricardo Anaya, and a slightly larger edge over Jose Antonio Meade of the ruling Institutional Revolutionary party, according to the survey by polling firm Consulta Mitofsky.
"The tendency favors Andres Manuel Lopez Obrador. ... I recognize his triumph," Anaya said in a speech to supporters.
Minutes earlier Meade had also conceded, saying that "for the good of Mexico, I wish him the greatest success."
- Rabbis, Imams and Ministers Unite on U.S.-Mexico Border in Support of Detained Migrants
- Why Mexico's Jews Are Embracing Netanyahu, Even Though He Endorsed Trump's Wall
- Russia Meddling in Mexican Election, Says Trump's National Security Adviser
Lopez Obrador, better known as AMLO, has said he will rule Mexico for the poor and fight rampant corruption.
"There is a lot of inequality, a lot of violence in this country," said Lopez Obrador voter Hugo Carlos, 73. "This situation has to be changed."
Exit polls by Consulta Mitofsky also forecast clear gubernatorial wins for allies of Lopez Obrador's Morena party in four of eight state races on the ballot plus for the head of government in Mexico City. The central state of Guanajuato was predicted to go to a candidate of the conservative National Action Party.
Lopez Obrador worries many who fear he could set the country back decades and lead to disaster with an interventionist economic policy.
He has pledged to give scholarships or paid apprenticeships to youth, and increase support payments for the elderly.
"I am concerned that some candidates are making proposals that are impossible, because they're very expensive to carry out," said Juan Carlos Limas, 26, who lined up at a Mexico City precinct to vote for Ricardo Anaya, who is running second in polls for a right-left coalition.
All the candidates are lambasting President Donald Trump's policies against migrants and Mexico, but voters were wondering who could best deal with Trump.
Sunday's elections for posts at every level of government are Mexico's largest ever and have become a referendum on corruption, graft and other tricks used to divert taxpayer money to officials' pockets.
Many saw this election as Lopez Obrador's best shot at the presidency after 12 years of near-permanent campaigning with his anti-establishment message falling on receptive ears amid widespread disillusionment with politicians.
"The corrupt regime is coming to its end," Lopez Obrador said at his final campaign event Wednesday. "We represent modernity forged from below."
Much of the popular ire has been aimed at unpopular President Enrique Pena Nieto's Institutional Revolutionary Party, or PRI, whose market-oriented economic reforms have yet to benefit many Mexicans, and Meade struggled during the campaign to escape popular rejection of the party.
Anaya tried to harness the youth vote with an emphasis on technology and new ideas, but he divided his own conservative party to take its candidacy and it's unclear if his new allies in the leftist Democratic Revolution Party will actually turn out for someone from the other end of the ideological spectrum.
Sunday was the first time that an independent candidate appears on the ballot.
Jaime "El Bronco" Rodriguez fought for attention with a horse-mounted "everyman" campaign and by tossing out policy bombs like his proposal to cut off the hands of public officials caught stealing. Without the big party machinery it was an uphill battle.
It is also the first time Mexicans living abroad can vote for down ballot races like senators. More than 181,000 received ballots and the 97,000 that the National Electoral Institute had gotten back by Friday morning were already double what they got in 2012.
Casting his own vote, Pena Nieto promised to work with whoever wins on the transition.
"The president of the republic and his government will be absolutely respectful and support the authorities that are elected," Pena Nieto told reporters.
In both of Lopez Obrador's previous two presidential losses he alleged fraud. In his first loss — by a mere 0.56 percent to conservative Felipe Calderon in 2006 — his supporters held months-long protests in Mexico City and he referred to himself as "the legitimate president."
His allies warned even before Sunday's presidential vote that there better not be any funny business.
Still, the voting was by and large peaceful, apart from the usual complaints about some volunteer-staffed polling places opening late.
The head of the country's electoral institute, Lorenzo Cordova, said voting was proceeding "peacefully, without major incidents," and that only four of the 156,807 polling places failed to open.
On Saturday, the Democratic Revolution party said four of its members were killed in Mexico State, west of Mexico City, while trying to prevent hand-outs of goods by the ruling party to potential voters.
The government of the northern state of Chihuahua reported that three people were arrested in the border city of Ciudad Juarez for allegedly trying to buy votes for an unnamed political party.
And in Michoacan state, polling places in a few villages were cancelled after some inhabitants said they didn't want elections involving political parties, which they mistrust. Some ballots were stolen and burned in the town of Nahuatzen to prevent voting.
In the northwestern border city of Tijuana, 29-year-old engineer Jorge Serrano Martinez said he voted for Lopez Obrador because he wanted "to give the opportunity to another political party to do different things."
"He is not linked to any act of corruption and he has a history as a social fighter," Serrano said. "I think he is the least corrupt of all."
DPA contributed to this report.