Mr Lopez Obrador has vowed to transform Mexico and overthrow the "mafia of power" he blames for looting the country.
The former mayor of Mexico City winning between 53% and 53.8% of the vote, according to a projection by the National Electoral Institute, based on a sample of polling stations.
It gave Ricardo Anaya of the conservative National Action Party (PAN) between 22.1% and 22.8%, Jose Antonio Meade of the ruling Institutional Revolutionary Party (PRI) between 15.7% and 16.3%, and independent candidate Jaime Rodriguez between 5.3% and 5.5%.
Governing party candidate Mr Meade conceded the election, saying Mr Lopez Obrador bears the responsibility of the next government.
"For the good of Mexico, I wish him the very best of success," Mr Meade said.
Opposition candidate and conservative Ricardo Anaya has also congratulated Mr Lopez Obrador on his win.
Mr Anaya said in a televised speech that "the trend favours" Mr Lopez Obrador, adding: "I recognise his triumph".
The result is a shift to the left for Mexico and a big break with the PRI and PAN which, between them, have governed the country for nearly a century.
He has vowed to transform Mexico, reduce its dependence on the US, rule for the poor and overthrow the "mafia of power" he says have looted the country.
He is a friend of Jeremy Corbyn and has been dubbed the Labour leader's "ideological twin". Mr Corbyn said Mr Lopez Obrador's victory "brings a new beginning for México".
Mr Lopez Obrador enjoyed a wide lead in opinion polls throughout the campaign, his third for the presidency.