Deputy Prime Minister Uhuru Kenyatta is the winner of Kenya's presidential election with 50.07%, the country's election commission said.
The official announcement came five days after the nation held its first national election since its 2007 vote sparked two months of tribe-on-tribe attacks that killed more than 1,000 people.
Jubilant supporters of Mr Kenyatta filled Kenya's streets to celebrate their candidate's victory.
Kenyatta, the son of Kenya's founding president, is indicted for crimes against humanity by the International Criminal Court (ICC), which is expected to create problems with the country's Western allies.
Mr Kenyatta's defeated rival, Prime Minister Raila Odinga, planned to hold a news conference to reveal his next step.
If Mr Kenyatta's victory holds, the son of Jomo Kenyatta will become the fourth president of Kenya since its independence from British colonial rule in 1963.
Mr Kenyatta's win could greatly affect Kenya's relations with the West. The president-elect faces charges at the ICC for his alleged role in directing some of Kenya's 2007 post-election violence. His running mate, William Ruto, faces similar charges.
The United States has warned of "consequences" if Kenyatta wins, as have several European countries. Britain has said it would have only essential contact with the Kenyan government if Mr Kenyatta is president.
Government officials have been working for months to avoid the post-election violence that brought Kenya to the brink of civil war five years ago, when more than 600,000 people were forced from their homes.
The final results showed that Mr Kenyatta won 6,173,433 votes - 50.07% - to Mr Odinga's 5,340,546 - 43.3%. More than 12,330,000 votes were cast, a record turnout of 86% registered voters.