Peruvian President Pedro Pablo Kuczynski narrowly survived an impeachment vote late Thursday by lawmakers accusing him of graft in relation to disgraced Brazilian construction firm Odebrecht.
"The demand for vacancy on grounds of permanent moral incapacity has not been approved," the speaker of the opposition-dominated chamber, Luis Galarreta, said after the motion received 79 votes in favor, 19 against and 21 abstentions.
The motion failed by eight votes, as at least 87 votes were required to approve an impeachment.
"Peruvians. Tomorrow begins a new chapter in our history: reconciliation and reconstruction of our country. One single force, one single Peru," a triumphant Kuczynski wrote on his Twitter account.
Dozens of people went to the presidential palace to congratulate him on the outcome.
The motion had been put to the lawmakers after a 14-hour session that started with a two-hour appearance by Kuczynski to defend his position.
He had called the move against him a "coup" and an "attack" on democracy.
Analysts had predicted that Kuczynski would be impeached, especially as 93 lawmakers had last week voted for the impeachment motion to be put to Congress.
The 79-year-old center-right president was accused of lying to cover up $5 million in payments received from Odebrecht that both he and the company insist were for legitimate consulting fees.
The money was received between 2004 and 2013, a period in part of which Kuczynski was economy minister and head of cabinet for then-president Alejandro Toledo.
Odebrecht has admitted to paying millions of dollars in bribes to officials in several Latin American countries to secure lucrative and inflated public works contracts.
It has said it paid $20 million in kickbacks to Toledo, whom Peru wants extradited from the United States to face charges.
Another former Peruvian president, Ollanta Humala, is in jail in Peru, also on suspicion of having illicitly received millions from Odebrecht in campaign funds.
The Brazilian company agreed over the past year to pay $2.6 billion in fines to the Brazilian, Swiss and US governments for its corrupt practices.
Kuczynski is one of the highest-profile politicians to be caught up in the scandal.
Last week, Ecuador's vice president, Jorge Glas, was sentenced to six years in prison for taking Odebrecht kickbacks.
In his defiant defense before Congress early Thursday, Kuczynski regretted being "careless and sloppy" about his business dealings, but the former Wall Street banker stated that his moral capacity should not be impugned.
He has repeatedly maintained that "I did not lie. I am not corrupt."
Political analyst Luis Benavente was one observer who had predicted that impeachment would happen, telling AFP before the vote that "President Kuczynski's luck has run out."
Maria Luisa Puig, Latin America analyst with the Eurasia consulting firm, had said it was a "close call" as to whether Kuczynski would be toppled, noting "the case has provided the opposition with the necessary justification to oust him with public support."
While Kuczynski saw off the impeachment threat on Thursday, public anger at perceived pervasive corruption in Peruvian politics was ignited. Demonstrations were held on Wednesday condemning graft.
One opposition party that led the impeachment drive, Popular Force, is also under a cloud formed by Odebrecht.
Its leader, Keiko Fujimori -- daughter of a former president who was imprisoned for corruption and human rights crimes -- has yet to answer to prosecutors about suspicions of Odebrecht-related wrongdoing.