Clutching a bible as he took oath in office, Kenya's president Uhuru Kenyatta declared on Tuesday, "I do swear that I will be faithful and bear true allegiance to the Republic of Kenya."
Kenyatta, wearing a dark suit and red tie, also pledged to "protect and uphold, the sovereignty, integrity and dignity of the people of Kenya".
Officials had to appeal for quiet as 60,000 people packed into Kenya's national football stadium chanted Kenyatta's name and roared in support as they danced.
William Ruto, who like Kenyatta faces trial at the International Criminal Court (ICC) for crimes against humanity in The Hague, took the oath of office as vice-president.
"I will always truly and diligently serve the people and the Republic of Kenya in the office of the deputy president,"
"I will do justice to all without fear, favour, affection and ill will," he added.
Security was heavy as Kenyatta loyalists, dressed in the red colours of the winning Jubilee Coalition party, waved as military bands played tunes to welcome the new leader and say farewell to outgoing President Mwai Kibaki, 81, retiring after more than a decade in power.
Before handing over power Kibaki circled the stadium waving to crowds from an open topped vehicle and accompanied by a guard of honour.
Heads of state of Kenya's neighbours watching the ceremony included Ethiopia's Hailemariam Desalegn, Somalia's Hassan Sheikh Mohamud, South Sudan's Salva Kiir, Tanzania's Jakaya Kikwete and Uganda's Yoweri Museveni.
Western nations, many of whom have a policy of only "essential contact" with ICC indictees, have said they sent ambassadors to the ceremony.