Many Guatemalans are fed up with the political class after investigations by the International Commission against Impunity in Guatemala (CICIG), a United Nations anti-corruption body, led to the arrest of then-President Otto Perez in 2015, and then threatened to unseat his successor Morales, a former television comedian.
With the results being updated in real time on the court's website, the institution's president, Julio Solorzano, declared the result "already irreversible".
As they cast their ballots, Torres and Giammattei urged voters to turn out and reiterated their pledges to fight unemployment, improve health care and education, and rid the country of corruption and violence. Torres led the race with about 26 percent.
On July 6, Morales' administration signed an agreement with the United States that would require Salvadorans and Hondurans to request asylum in Guatemala if they cross through the country to reach the U.S. The new president will have to decide whether to nullify or honor the agreement, which could potentially ease the crush of migrants arriving at the U.S. border.
Giammattei is to take office January 14.
The country's general elections were held June 16, but no presidential candidate won the necessary votes to assume the post after the first round.
Guatemala's incoming president Alejandro Giammattei has vowed to seek better terms for his country from an unpopular migration deal agreed with Washington last month, but any room for maneuver is seen as likely to be hampered by weakness in the national Congress.
Investigative website Nomada branded him as "impulsive... despotic, tyrannical... capricious, vindictive", among other undesirable traits.
"The next president faces a lose-lose situation when it comes to managing the deal with the United States", she said.
The 63-year-old has promised to erect an "investment wall" on the border between Guatemala and Mexico to curb migration, and also proposed bringing back the death penalty.
US President Donald Trump speaks about the mass shootings from the Diplomatic Reception Room of the White House in Washington, DC, August 5, 2019.
Until courts prevented some of the more popular candidates from running in this year's race, he also appeared to be a long-shot candidate in a tumultuous campaign season. At least 1% of Guatemala's population of some 16 million has left the country this year.
In a poll by Prodatos for the Prensa Libre newspaper, 82 percent of respondents opposed it.
But rejecting the migration pact would run the "risk of retaliation from Trump", Grais-Targow said, after the USA leader threatened a travel ban, tariffs and remittance fees if Guatemala didn't bend to his will. That compares to Guatemala's export revenue of $10.5 billion.
Nearly 60 per cent of Guatemala's 17.7 million citizens live in poverty, and the country has one of the highest murder rates in the world. According to the World Bank, remittances account for 12% of the country's gross domestic product.
On July 6, Morales' administration signed an agreement with the USA that would require Salvadorans and Hondurans to request asylum in Guatemala if they cross through the country to reach the U.S.
Adriana Beltran, director of citizen security at the Washington Office on Latin America (WOLA), a think tank, said the CICIG might just have a future "if Guatemalans take to the streets and there is enough pressure from within".
Around half the killings are blamed d on drug trafficking and extortion operations carried out by powerful gangs.
And in June, a woman and three children died from heat and dehydration in Texas.
Giammattei, a trained surgeon and veteran public sector bureaucrat who had failed in three previous bids to secure the presidency, has called the accord 'bad news, ' saying Guatemala is not ready to cope with a potential jump in asylum-seekers.
More than 250,000 Guatemalans were detained between October 2018 and July this year for trying to enter the USA illegally, Washington's embassy said.