A second round run-off will be held in Guinea-Bissau's presidential election, after no candidate won 50% of the votes, the electoral commission says.
More than 80% of voters cast their ballots
Malam Bacai Sanha of the PAIGC party, which led Guinea-Bissau to independence from Portugal in 1973, got most votes.
His second round opponent will be former military ruler Joao Bernardo "Nino" Vieira.
The election is seen as a chance to end years of instability. Turn-out was high with long queues at polling stations.
The UN special representative to Guinea-Bissau, Joaquim Chissano, described the election as exemplary.
Kumba Yala, who was ousted in a 2003 coup, came third and will not contest the run-off.
The secretary general of his Social Renewal Party rejected the results, saying they were "false", reports the AP news agency.
The electoral commission did not publish the results in percentage terms but said that more than 80% of voters had cast their ballots.
The PAIGC won a majority in March 2004 parliamentary elections, which were praised as "free, fair and transparent".
Malam Bacai Sanha: 158,000
Nino Vieira: 129,000
Kumba Yala: 111,000
While it is hoped that the new leader will turn the country's fortunes around, some fear that the losers may not accept the results, plunging Guinea-Bissau into a new round of conflict.
Decades of instability have made Guinea-Bissau one of the world's poorest countries.
According to the UN, 80% of its population lives on less than $2 (£1.60) a day.
The next leader of this former Portuguese colony of 1.4 million people will have to find a way of reviving the sluggish economy centred on cashew-nut production.
The vote is being monitored by some 200 observers from the US, the EU and West African states.