Citing irregularities, Chief Justice David Maraga said a new vote should be held within 60 days.
Reading the ruling, which was reached by a majority of four to two among the judges, Justice Maraga said the 8 August poll had not been “conducted in accordance with the constitution.”
The election commission had declared Kenyatta the winner of the election by a margin of 1.4 million votes, but the opposition led by Raila Odinga argued that the commission’s IT system had been hacked to manipulate the results.
After the announcement, opposition supporters were seen celebrating outside the court building, as well as in opposition strongholds.
Kenya has become the first country in Africa to annul presidential election.