People danced in the streets after the announcement of Uhuru Kenyatta's victory, while areas loyal to Raila Odinga plunged into gloom.
In the western lakeside city of Kisumu, an Odinga stronghold and his home region, youths jeered at paramilitary units and chanted "No Raila, no peace", as local police and community leaders appealed for calm.
When the electoral commission confirmed that Kenyatta would be the new president, around 100 youths started stoning police. But amid fears of a repeat of the violence that devastated Kisumu and other towns five years ago after the last elections, police moved swiftly to contain the violence.
Shops in the centre of the city, which had begun opening up, quickly shuttered again, and the area became largely empty.
Other angry youths congregated on street corners, but they appeared to have paid heed to Odinga's appeal for calm while he sought a legal challenge to the election. He called for his supporters to treat all Kenyans as "brothers and sisters".
"Raila said he is going to court – we are waiting, we don't want to cause chaos," said unemployed Samson Ochieng in Kisumu's Manyatta district, his eyes heavily bloodshot.
"We know they are there to kill us if we do something," he added, looking at the trucks of security forces stationed around the town.
Despite warnings of the potential for violence ahead of elections, no major or large scale incidents were reported in the hours following the release of results.
But discontent was at its strongest in the slums of Kisumu. "This is a stolen election," said transporter Andrew Owiti. "We have been very peaceful but enough is enough, we want the truth."
Earlier in the day local church leader Washington Ogonyo Ngede, a crucifix around his neck, had come to pray with the crowd and urge those gathering to remain calm.
"We came here to appeal for peace – for all our youths here to keep the peace," he said.
After the 2007 elections Kisumu was the scene of burning and looting by angry youths. Security forces put down the violence with great brutality, killing more than 100 people.
In the Rift Valley town of Nakuru, which voted overwhelmingly for Kenyatta's coalition, thousands of people – from grannies to children, thronged the streets, dancing themselves into a frenzy.
In Naivasha, another Rift Valley town, hundreds poured out, some of them naked to the waist despite the highland evening chill.
On foot, hoisting their friends shoulder high, piled on motorcycles, perched precariously on the top of lorries and buses they blocked the streets of the town singing loudly.
"We are grateful that it's all over and we have a new leader," said Martin Mugwe.
"We call on those who have lost to concede defeat so that the country can have peace and we can move on from here," he said.
The celebrations were also marked in the towns of Mai Mahiu and Gilgil with the residents calling on the president-elect to embark on uniting Kenyans.
"The campaigns divided Kenyans on tribal and political lines and we appeal to Uhuru to use his first days in the job in uniting all the communities," said Alice Korir. – AFP