Mexicans go to the polls in a historic election in which two women compete to lead the country

Whoever succeeds Mr. López Obrador will face daunting challenges.

Cartel violence continues to plague the country, displacing people en masse and fueling one of the deadliest election cycles in recent Mexican history. López Obrador has turned the government’s attention to addressing the causes of violence instead of declaring war on criminal groups, a strategy he called “hugs, not bullets.”

Ms. Gálvez criticized this approach.

“Enough with hugging criminals and shooting citizens,” he joked during the election campaign. She said he would withdraw the armed forces from civilian activities and direct them to focus on fighting organized crime, while strengthening the police.

Ms. Sheinbaum said she would continue to focus on the social causes of violence, but would also work to reduce rates of impunity and strengthen the National Guard.

Economically, the opportunities are clear: Mexico is now the United States’ largest trading partner, benefiting from the recent shift in manufacturing away from China. The currency is so strong that it has been labeled a “super peso”.

But there are also problems with simmering. The federal deficit has risen to about 6% this year and Pemex, the national oil company, operates under a mountain of debt, straining public finances.