Guinea-Bissau opposition leader Umaro Cissoko Embalo, a former prime minister, won the presidential election with 53.55 percent of votes, the National Electoral Commission (CNE) announced on Wednesday.
His rival Domingos Simoes Pereira, head of the country's ruling PAIGC party, took 46.45 percent in Sunday's runoff.
"I declare Umaro Sissoco Embalo to be the winner of this second round," said CNE President Jose Pedro Sambu.
After the announcement, Pereira told his supporters he will contest the result at the Supreme Court.
Outgoing Jose Mario Vaz came to power in 2014 on hopes of stabilising a country notorious for coups and assassinations since gaining independence from Portugal in 1974.
But his tenure was hampered by a paralysing face-off with Parliament under the country's semi-presidential political system.
The CNE put turnout at 72.67 percent, similar to the first round of voting on November 24, which Pereira won with 40.1 percent against 28 percent for Embalo.
Embalo, 47, is a reserve brigadier general who favours wearing a red-and-white Arab keffiyeh headdress.
Like Pereira, who was also a prime minister, he served under Vaz - between 2016 and 2018, before representing Madem, a party formed by PAIGC rebels.
He fought to overcome his first-round vote deficit by portraying himself as a unifier of the country and by gaining the backing of eliminated candidates, including Vaz.
Born in the capital city Bissau, Embalo is a member of the Fulani ethnic group. At university, he studied social and political science in Spain and Portugal.
A father of three, Embalo is a football fan and supports Belgian team Standard Liege.
He sought early retirement from the army in the 1990s, and launched an investment fund set up by the then Libyan government.
In October, Prime Minister Aristide Gomes of the PAIGC accused him of plotting a coup, charges Embalo denied.