López Obrador has pledged to reduce the country's economic dependence on its powerful northern neighbor, but also said he hopes to persuade President Donald Trump to help Mexico and Central America develop so as to contain illegal immigration to the U.S.

Mexico's current president, Enrique Peña Nieto, has quarreled with Trump over trade and immigration. The first high-level contact between López Obrador and the White House is likely to be a phone call later on Monday. Trump tweeted his congratulations Sunday night, saying, "There is much to be done that will benefit both the United States and Mexico!"

Earlier Sunday, Trump raised the possibility of taxing cars imported from Mexico if there are tensions with the new government.

According to a quick count by the electoral authority, López Obrador won 53 percent to 53.8 percent of the vote — more than double the total for his nearest rival. His allies were also forecast to win majorities in the Senate and lower house, according to a prominent exit poll.

The nationwide election effort was marred by violence, with an estimated 130 politicians killed in the course of the campaign across the country. For over a decade, the Mexican military has also been waging a war against hugely powerful drug cartels.

"We have witnessed today a very profound reshaping of the country's political map," Goldman Sachs economist Alberto Ramos told Reuters. "The balance of power at the federal and local levels has definitely shifted to the left, with unclear implications for the near-term policy direction."

Ruling party candidate José Antonio Meade conceded the election earlier on Sunday, saying his rival bore the responsibility of the next government and wishing him well.

Mexico City was the scene of jubilation, with supporters honking their horns to the tune of "Viva Mexico!" and waving Mexican flags. Thousands heeded López Obrador's call to gather in the sprawling main square known as the Zocalo, with many dancing to mariachi music.

"This is the change we needed," said supporter Mario Alvarez, 40.

"AMLO was the right choice. Mexico is corrupt. It won't be easy, but it's a start," he added, referring to López Obrador by his initials, a widely used nickname.

Emilia Gutierrez, 34, was smiling as she rode her bike to the Monument to the Revolution to celebrate with fellow López Obrador supporters.

"It's the first time the country feels happy," she said. "It's about what he represents. So many doors have been closed in Mexico. Now one opens."

His victory highlighted the widespread discontent with outgoing Peña Nieto's ruling centrist Institutional Revolutionary Party, or PRI, which has governed Mexico for 77 of the past 89 years. Peña Nieto also congratulated López Obrador Sunday, saying, "He and his team will have the support of the Mexican government to make an orderly and efficient transition."

Supporters of Andrés Manuel López Obrador gather in Mexico City's Zocalo after his victory. Goran Tomasevic / Reuters

López Obrador is no stranger to political campaigns. This was his third consecutive attempt to win the country's highest office. Mexican presidents sit for one six-year term and are prohibited from holding office again.

López Obrador has pledged to combat inequality, improve pay and welfare spending, and run a tight budget but has been vague on policy details. Around half of the Mexico's population of 124 million live in poverty.

He has also promised to root out widespread corruption.

"Whoever it is will be punished, I include comrades, officials, friends and family members," López Obrador said Sunday. "A good judge begins at home."

He has shunned the typical trappings of office and said that he will live in his own home, turn the official residence into an arts center, sell the presidential plane and cut his salary.

Addressing accusations of authoritarianism, López Obrador told tens of thousands of supporters last week that there would be no dictatorship. He promised to respect the separation of powers, freedom of the press and the independence of the central bank.