Conservative Alejandro Giammattei was elected as Guatemala's president on Sunday, defeating former first lady Sandra Torres in a run-off, the central American country's electoral court said.
The institution's president Julio Solorzano declared the result "already irreversible" part-way through the counting.
"The aim is fulfilled," Giammattei said.
He had polled almost 58.5% with a lead of 550,000 votes and only a few thousand left to count when the court declared him the victor. More than 99% of ballots have now been counted.
Giammattei will take over in January from corruption-tainted President Jimmy Morales, who congratulated his successor and promised a "transparent and orderly" transition.
He will be under immense pressure from the United States to implement a controversial migration pact that would allow Washington to send most Honduran and Salvadoran asylum seekers who passed through Guatemala back to the poor, crime-ridden country.
The two candidates had both avoided committing to strong positions on the U.S. deal.
Corruption was the main issue leading up to the first round of elections in June -- which Torres topped -- but that has been superseded by the political scandal over the migration deal.
Neither candidate arrived with a glowing reputation.
The center-left Torres, whose ex-husband Alvaro Colom was president from 2008-2012, has been suspected of involvement in corruption.
Influential businessman Dionisio Gutierrez recently described her as "a questionable politician with a history that should worry any citizen."
Giammattei has hardly come off any better.
Investigative website Nomada branded him as "impulsive... despotic, tyrannical... capricious, vindictive," among other undesirable traits.
But the 63-year-old, a doctor by profession, scored well on voter concerns such as the economy, corruption and security, according to Risa Grais-Targow of the Eurasia Group.
However, he now faces "a lose-lose scenario" regarding the migration pact, Grais-Targow said.
One of Morales's last acts as president was to authorize an agreement with the U.S. administration of Donald Trump designating Guatemala as a "safe third country," which would permit Washington to turn away asylum seekers who did not seek refuge when passing through Guatemala.
The pact -- part of Trump's campaign to stem the flow of migrants to the southern U.S. border -- has proved highly unpopular in Guatemala, with demonstrators blocking roads and occupying the University of San Carlos in protest.
In a poll by Prodatos for the Prensa Libre newspaper, 82%f respondents opposed it.
But rejecting the migration pact would run the "risk of retaliation from Trump," Grais-Targow said, after the U.S. leader threatened a travel ban, tariffs and remittance fees if the country did not bend to his will.
Remittances from Guatemalans in the U.S. are a crucial part of the economy, reaching a record $9.3 billion last year. That compares with Guatemala's export revenue of $10.5 billion.
According to the World Bank, remittances account for 12% of the country's GDP.
The agreement was reached last month despite Guatemala's constitutional court having earlier granted an injunction blocking Morales from signing the deal.
Almost 60% of Guatemala's 17.7 million citizens live in poverty, and the country has one of the highest murder rates in the world.
Around half the killings are blamed on drug trafficking and extortion operations carried out by powerful gangs.
Morales, barred by Guatemalan law from seeking a second term, urged his replacement to reduce undocumented migration, improve education and tackle chronic malnutrition in the under-fives, which affects 46 percent of infants.
Guatemalans are not subject to Trump's proposed migrant measures, but given that poverty in some indigenous areas reaches 80 percent, many embark on the journey in search of the "American dream" despite the dangers.
Since December, at least five Guatemalan children have died in U.S. custody after crossing into the country from Mexico.
And in June, a woman and three children died from heat and dehydration in Texas.
"The problem is that as there's no work in Guatemala, many people want to migrate and it's sad what's happening to our Guatemalan brothers who die or are killed," Emilio Canel, a 26-year-old farmer in Sumpango, told AFP.
More than 250,000 Guatemalans were detained between October 2018 and July this year for trying to enter the U.S. illegally, Washington's embassy said.
Please click to read our informative text prepared pursuant to the Law on the Protection of Personal Data No. 6698 and to get information about the cookies used on our website in accordance with the relevant legislation.
6698 sayılı Kişisel Verilerin Korunması Kanunu uyarınca hazırlanmış aydınlatma metnimizi okumak ve sitemizde ilgili mevzuata uygun olarak kullanılan çerezlerle ilgili bilgi almak için lütfen tıklayınız.