(Bloomberg) -- Claudia Sheinbaum became Mexico’s first female leader in a landslide victory, capitalizing on outgoing President Andres Manuel Lopez Obrador’s popularity while also inheriting rampant criminal violence and a large fiscal deficit left by his government.  

The former mayor of the nation’s capital and candidate for the ruling Morena party won Sunday’s election by a margin of at least 30 percentage points, according to the nation’s electoral authority. It was a crushing blow for the main opposition led by Xochitl Galvez and further consolidates the party AMLO founded as Mexico’s dominant force.

Sheinbaum, 61, and her allies also won two-thirds of the seats in the lower house and expect to replicate that success in the senate. Such a supermajority would gift her the power to approve constitutional changes that have eluded AMLO. The peso reversed earlier gains versus the dollar as investors worried about her iron grip on the legislative agenda.

“I want to thank the recognition that the people of Mexico have given to our project for the nation,” Sheinbaum said in a speech after midnight, concluding with a “Viva Mexico!”

Still, the task facing the scientist-turned-politician is daunting. 

AMLO, as her mentor is known, allowed drug cartels to expand their influence across Latin America’s second-biggest economy, resulting in record murder rates. He also went on a spending spree toward the end of his mandate, writing out welfare checks that made him a hero to the working poor but left the country saddled with the largest fiscal deficit since the 1980s.

The challenge for Sheinbaum is that she owes AMLO her victory and now needs to tread carefully around his legacy. AMLO has an approval rating of about 60%, meaning he could have easily won the vote if the constitution didn’t bar presidents from seeking reelection. 

So while Sheinbaum pledged on the campaign trail to follow his vision, she cannot afford to leave a public security crisis to fester. Mexico’s largest-ever elections were also the deadliest in its modern history.

Read More: AMLO Looms Over His Protege’s Path to Historic Victory in Mexico

AMLO Legacy

Amid a weakening economy, she must also find a permanent fix for state-owned Petroleos Mexicanos, the world’s most indebted oil company, which has become a drag on public finances. Rating firms have already warned that no action could cost Mexico its investment grade.

Follow Mexico’s election results here.

Sheinbaum’s victory represents a vote of thanks to AMLO as much as a vote of enthusiasm for the candidate herself, said Andrew Paxman, a history professor at the Center for Research and Teaching in Economics. “Whether that is enough for her to remain an effective leader remains to be seen, because of this question mark that is her future relationship with congress.”

While winning by a large margin will help Sheinbaum push her agenda through congress, a crucial question persists: Will her government be merely an extension of AMLO’s or will she seek meaningful changes to address Mexico’s most pressing issues? 

The prospect of Morena becoming even stronger — coupled with uncertainty about whether Sheinbaum would pursue controversial reforms of the judicial and electoral systems AMLO sought and failed to approve — have investors worried. They would have preferred a robust opposition that keeps her in check.

Read More: As Deadly Accidents Piled Up, Bond Investors Got Tough on Pemex

And even if she decides to make changes, it’s uncertain how far she would be able to go. Over his six-year term, AMLO has made profound changes to institutions such as the military, which he turned not only into the most visible security force in the country, but also into a construction behemoth in charge of building and running airports, railroads and other infrastructure projects. 

She will also have to consider whether to implement business-friendly reforms and promote investment in energy, water and other infrastructure projects for Mexico to take full advantage of the nearshoring trend that has companies seeking to relocate closer to the large US consumer market. 

Super Peso

Under AMLO, the national currency became the best performer in emerging markets. The “super peso” was initially a welcome development because it stimulated domestic consumption of imports. But it has become a burden for the economy, raising production costs of exporters and weakening the purchasing power of remittances that Mexicans receive from relatives abroad.

Some business leaders see signs that Sheinbaum could be friendlier to the private sector, and more open to change the nationalist energy policies implemented by AMLO. That remains to be seen. She has mostly stuck to the basic tenets that made the outgoing leader so popular, promising to expand welfare programs and decrying corruption at all ranks. 

Many of Sheinbaum’s policies — from the relationship with China to migration — will also depend on who the next US president will be. Donald Trump’s possible return to the White House may be a complicating factor as it’s not clear whether both leaders would get along.

Domestically, Sheinbaum will also need to keep the ruling coalition united. Morena has left-wing roots but has grown to host members who defected from other parties, becoming an amalgamate with little ideological consistency. 

The outgoing president has promised to hand over the reins and retreat to his ranch after leaving office, but whether he’s really ready to leave the spotlight is another question — especially if the ruling coalition starts to fracture. 

--With assistance from Carolina Millan, Michael O'Boyle, Andrea Navarro and Scott Squires.

(Updates to reflect Sheinbaum’s victory, adds market reaction)

©2024 Bloomberg L.P.