Lopez Obrador, 67, said he was receiving medical treatment and his symptoms are mild.
[Ads /]
"As always, I am optimistic," he tweeted.
Lopez Obrador took office as president in December 2018.
[Ads /]
He is among a number of world leaders who have contracted the virus during the pandemic. Most have since recovered. Among them: Boris Johnson of Great Britain, Emmanuel Macron of France, Jair Bolsonaro of Brazil, and former U.S. President Donald Trump.
Ambrose Mandvoul Diamini, the prime minister of Eswatini - the southern Africa nation also known as Swaziland - died in December 2020 about a month after a positive test for COVID-19.
The Associated Press contributed to this report.