image sourceAFPimage captionSupporters of Hakainde Hichilema have been celebrating on the streets of Lusaka
Zambia's electoral commission has confirmed that last week's presidential election was won by the opposition candidate Hakainde Hichilema.
Mr Hichilema defeated his main rival, the outgoing President Edgar Lungu, by more than a million votes.
It was Mr Hichilema's sixth attempt at winning the presidency. His supporters have been celebrating on the streets of the capital, Lusaka.
Earlier, Mr Lungu alleged that the elections were not free and fair.
He said election officials from his Patriotic Front party had been chased from polling stations, leaving votes unprotected.
In response, Mr Hichilema's United Party for National Development said the statement was the "desperate final act of an outgoing administration".
- EXPLAINER: Which African states have shut down the internet?
- ANALYSIS: Young voters may hold the cards in Zambia election
In its final tally, the electoral commission said Mr Hichilema had won 2,810,777 votes to Mr Lungu's 1,814,201 in Thursday's election. There were seven million registered voters.
The landslide win means Mr Hichilema will not have to fight a run-off contest.
"I therefore declare that the said Hichilema to be president of Zambia," commission chairman Esau Chulu announced at the results centre in Lusaka.
Mr Lungu's six-year rule was criticised for alleged human rights abuses, corruption, a failing economy and massive unemployment.
Correspondents say Mr Hichilema, 59, tapped into widespread dissatisfaction among voters.
He now faces the daunting challenge of turning around the country's economic fortunes.
media captionZambia elections: What you need to know