Kenyatta leading with 55 percent of the vote to Odinga's 44 percent in early results released by the electoral commission (IEBC).
PIC: Electoral Commission officials count ballots at a polling station in Nairobi on Tuesday. (AFP)
Vote counting was underway in Kenya Tuesday night after elections dominated by a close battle between President Uhuru Kenyatta and his rival Raila Odinga, which has raised fears of violence in east Africa's most vibrant democracy.
Kenyatta was leading with 55 percent of the vote to Odinga's 44 percent in early results released by the electoral commission (IEBC), but with just 9,405 of the country's nearly 41,000 polling stations counted, it was too soon to tell if the incumbent's lead would hold.
Emotions are high after a bad-tempered campaign marred by opposition claims of a plot to rig the vote, and counting is considered the most sensitive part of the process in a country with a history of post-poll violence.
"We now enter the most critical moment in the election cycle," IEBC chief Wafula Chebukati told reporters after polls closed.
More than one-and-a half million votes had been tallied in the presidential vote, but as night fell some were still voting due to delays and long queues.
Tuesday's elections took place a decade after a shambolic 2007 vote -- which foreign observers agreed was riddled with irregularities -- sparked violence which left more than 1,100 people dead and 600,000 displaced.
People stood patiently for hours in snaking queues around the country for a vote that went off peacefully, despite reports of some technical glitches and delays.
Kenyatta, who is seeking a second term in office, urged Odinga to accept the result should he lose.
"I also want to say that if I lose, I will accept the will of the people," Kenyatta said after voting.
Odinga, 72, is taking his fourth and likely final stab at the presidency. He claims elections in 2007 and 2013 were stolen from him.
"In the unlikely event that I lose I don't need a speech, I will just speak from my heart," he said shortly before voting.
The IEBC electoral commission moved quickly to deal with any complaints, removing clerks in a polling station where ballot papers were pre-marked as "rejected".
In the port city of Mombasa a clerk was arrested for issuing double ballot papers to certain voters, local police said.
IEBC chief Wafula Chebukati said voting had gone "smoothly" despite minor delays and technical hiccups at some polling stations.
In semi-arid northwest Turkana, flooding from heavy rain cut off roads and several polling stations had still not opened by closing time.
Odinga's National Super Alliance opposition coalition (NASA) released a statement praising poll officials and security forces.
"We commend them for the good job so far and urge them to keep it up," it said.
However, the coalition complained some of its voters had been turned away or their names were missing from the voters' register.
NASA also said it had reports of "pre-marked ballot papers" and attempts to bribe voters.
As vote tallying starts, the focus is on the electronic system in place to send results to Nairobi. The failure of this system in 2013 meant votes had to be counted manually, leading Odinga to cry foul.
'Same old faces'
The devolution of power to Kenya's 47 counties after a post-conflict constitutional reform means elections are now a complex affair, with citizens casting six different ballots.
The presidential election is set to be the final showdown of a dynastic rivalry that has lasted more than half a century since the candidates' fathers Jomo Kenyatta and Jaramogi Odinga went from allies in the struggle for independence to bitter rivals.
The men belong to two of Kenya's main ethnic groups, Kenyatta from the Kikuyu, the largest, and Odinga from the Luo.
Both have secured formidable alliances with other influential communities in a country where voting takes place largely along tribal lines.
At a polling station in the capital, 54-year-old Concepta, who did not give her surname, was one of those still waiting in line, and said she still did not know who she would vote for.
"It's the same old faces, again and again. I was hoping there would be someone new but unfortunately, it's Kenyatta/Odinga again," she said.
Kenyatta, 55, is seeking re-election after a first term in which he oversaw a massive infrastructure drive and steady economic growth of more than five percent.
"Kenyatta has done a tremendous job, he has improved communications, built roads and other infrastructure, he has to keep the job," said Sashikat Bhaga, 68, in the Nairobi suburb of Parklands, home to many Kenyans of Indian or Pakistani origin.
But he has been criticised for soaring food prices -- with prices jumping 20 percent year-on-year in May -- and massive corruption scandals on his watch.
More than 150,000 members of the security forces were deployed for polling day.
There are more than 19 million registered voters in the nation of 48 million. Half are aged under 35.