Former Guinea-Bissau Prime Minister Umaro Cissoko Embalo has been elected president after winning a run-off vote against another ex-prime minister.
The 47-year-old beat rival Domingos Simoes Pereira by about 54% to 46%, the electoral commission announced.
Mr Pereira vowed to contest the result, alleging “electoral fraud”.
Mr Embalo has said he wants to resolve political tensions in the West African country, which has seen nine coups or attempted coups since 1974.
Incumbent President Jose Mario Vaz crashed out of the election in the first round in November.
He was the first head of state to carry out his term without being either deposed or assassinated, but his tenure was marred by issues including political infighting and widespread allegations of corruption.
His campaign team accused rivals of electoral fraud, but West African regional bloc Ecowas rejected the claims and warned that a military force was on standby to “re-establish order” in the event of a coup.
Election observers have also said they found no evidence of vote tampering in Sunday’s run-off, but Mr Pereira – leader of the country’s historic ruling party PAIGC – said the results were “full of irregularities, annulment and manipulation” as he vowed to mount a challenge in the Supreme Court.
Opposition candidate and former army chief Mr Embalo, nicknamed “The General”, served as prime minister between 2016 and 2018.
He sought to overcome his rival’s lead in the first round by pledging to unify the country and gaining the backing of eliminated candidates, including Mr Vaz.
Mr Embalo has also vowed to modernise Guinea-Bissau – one of the world’s poorest nations, which is home to some 1.6 million people.
His supporters celebrated his victory in the capital Bissau on Wednesday, dancing and beating pots and pans, AFP news agency reports.
As president, he will face major challenges including poverty and drug trafficking, as well as the unstable political system that led to an impasse under Mr Vaz’s presidency in which parliament can appoint the prime minister, but this appointee can be fired by the president.