His rival, Hakainde Hichilema of the United Party for National Development, who earlier denounced Tuesday’s election as a sham, came close with 46.7% of the vote.
The election was called after the death of President Michael Sata last October.
Mr Lungu, who will be sworn in on Sunday, said he aims to complete economic development projects begun by his predecessor.
On Saturday, Mr Hichilema called the “election” stolen, accusing the electoral commission of manipulating the results to favour Mr Lungu, a former lawyer.
In the interim period following Mr Sata’s death, Zambia was ruled by Guy Scott, a white Zambian of Scottish descent.
He was prohibited from contesting the election because his parents were not born in Zambia.
Mr Scott was the first white president in mainland Africa for 20 years and has been involved in Zambian politics since the 1990s.
Though he was close to Mr Sata and served as his running mate, his relationship with Mr Lungu is less cordial.
In November he sacked Mr Lungu as the Patriotic Front’s secretary-general prompting riots in the country.
Mr Lungu will serve the remainder of Mr Sata’s term until elections in 2016.