Mr Sata was declared winner by Chief Justice Ernest Sakala after polling 43% of the vote with just seven constituencies left to be counted.
The election had been marred by riots in Zambia’s northern mining region. The anger had been prompted by a ban on the media announcing results not verified by the electoral commission.
The electoral commission said it had taken the step after its website was hacked to falsely record a landslide for 74-year-old Mr Sata.Mr Banda’s Movement for Multiparty Democracy (MMD) has ruled Zambia for 20 years and this was the fourth time Patriotic Front (PF) leader Mr Sata had run for the presidency.
He lost the last election, in 2008, by just 35,000 votes which sparked rioting by some opposition supporters in the party’s urban strongholds.