Bingu wa Mutharika, 61, who was the outgoing president's chosen successor, defeated four other candidates including opposition leader Gwanda Chakuamba, the electoral commission announced after three days of ballot-counting.
Riots rocked three townships of Blantyre, the economic capital, after police prevented opposition supporters from attending a rally during which Chakuamba was to make an address.
The offices of the ruling United Democratic Front (UDF) party were torched in Chitawira township as opposition supporters put up barricades, an AFP correspondent saw.
"We are angry with the electoral commission and the UDF for rigging the elections", said one supporter who did not want to give his name.
A former economy minister, Mutharika won a little over a third of the three million votes cast, the electoral commission said.
"I declare Bingu wa Mutharika the winner," said James Kalaile, chair of the electoral commission.
Chakuamba's seven-party Mgwirizano (Unity) Coalition rejected the outcome, with secretary general Ian Nankhuni saying: "We don't agree with the figures."
Mutharika was due to be sworn in on Monday in the presence of several African presidents, including South Africa's Thabo Mbeki.
Voters in Malawi, one of the world's poorest nations, went to the polls on Thursday to elect a new parliament and a successor to President Bakili Muluzi, who is reluctantly stepping down after two terms in office.
Muzuli is credited with improving human rights in Malawi during his 10 years in office following the three-decade dictatorial rule of Kamuzu Banda.
Mutharika has pledged to bring economic stability to develop Malawi, which has an annual per capita income of $210.
Chakuamba, 69, claimed victory before the results were announced, saying that his supporters, independent groups and church officials who monitored the voting considered him "the clear winner."
"I am therefore the rightful president-elect, based on the figures from the actual polling stations," he said late on Saturday.
The elections in Malawi have been criticised by international observers including EU monitors who cited "serious shortcomings" in preparing the voters' list and biased media coverage.