Kenyan President Uhuru Kenyatta has won a second term, the country's election commission said.
The commission said Mr Kenyatta won Tuesday's election with 54% of the vote and called the poll "credible, fair and peaceful".
Hundreds of police in anti-riot gear are in the streets of the capital, Nairobi, amid fears of further protests by supporters of opposition candidate Raila Odinga who claims the vote was rigged.
A spokesman called the vote a "charade" and said going to court to challenge it is not an option.
The election has been a test of the stability of the East African economic power as many recalled the post-election violence a decade ago that left more than 1,000 dead.
Kenya has been relatively calm this week.
Mr Kenyatta appealed for unity and said "there is no need for violence" following the election announcement.
The election commission rejected Mr Odinga's claims that its database was hacked and results manipulated against him. This may have been the last chance at the presidency for the 72-year-old after three unsuccessful attempts.
The long wait for election results increased tensions in the nation of 44 million people, though the commission by law had until Tuesday to announce them.
At least three people were shot and killed during clashes between police and opposition supporters this week.
Mr Odinga, a former prime minister, claims that hackers infiltrated the election commission's computer system with the identity of a murdered election official and altered results to favour the 55-year-old Kenyatta, the son of Kenya's first president after independence from British colonial rule.
On July 31, officials announced that Christopher Msando, an election official in charge of managing information technology systems, had been tortured and killed.
In addition, the American CEO of a campaign data firm working for Mr Odinga was deported last weekend after the opposition said security forces threw him into the boot of a car.
The election commission said there was a hacking attempt but it failed, and that Mr Odinga's camp had no right to declare him as the winner.
The opposition earlier on Friday said it had asked for access to the commission's servers to confirm whether the alleged hacking took place, and it said it would accept the results even if they showed that Mr Kenyatta won.
International election observers have said they saw no signs of interference with the vote. Election officials spent recent days confirming provisional results with checks of documents from polling stations nationwide.
Opposition supporters on Friday burned tyres and blocked roads in the Nairobi slum of Kibera and in Kisumu, a city in the south west where Mr Odinga has strong support.
US ambassador Robert F Godec said any disputes should be dealt with through legal channels. "No Kenyan should die because of an election," he said.
Mr Odinga lost the 2007 election that was followed by violence fuelled by ethnic tensions that killed more than 1,000 people. He also lost the 2013 vote to Mr Kenyatta and took allegations of vote tampering to the Supreme Court, which rejected his case.