The ceremony took place in a packed stadium with police driving back other Kenyatta supporters trying to get in without seats.
Riot police were also deployed in another part of the city to stop a rally by opposition supporters.
Opposition leader Raila Odinga, however, mocked Kenyatta’s “coronation”.
He boycotted the re-run of the presidential poll last month and says Kenyatta was not elected legitimately.
Kenyatta was officially re-elected with 98% of the vote on 26 October but just under 39% of voters turned out.
The original election on 8 August was held over again after being annulled by the Supreme Court on grounds of irregularities.
There were scenes of chaos outside Nairobi’s Kasarani sports stadium when people without seats tried to rush in and were driven back by police with tear gas, and on horseback.
Big screens had been promised so that tens of thousands of people could watch the ceremony from outside the stadium but no screens were provided, AFP news agency reports.
Inside the stadium itself, foreign dignitaries took up their seats in a calm, good-humoured atmosphere.
Spectators were treated to musical performances and a military parade.
Eunice Jerobon, a trader who travelled overnight from the Rift Valley town of Kapsabet for the inauguration, told Reuters news agency of his hopes under the re-elected president.
“I’m sure Uhuru will be able to bring people together and unite them so we can all work for the country.”