There was controversy after Gen Fonseka was unable to vote
Votes are being counted in Sri Lanka's first presidential election since Tamil Tiger rebels were defeated after more than 25 years of civil war.
Election day passed largely peacefully despite several minor bomb blasts.
President Mahinda Rajapaksa faces a close contest against his bitter rival, former army chief Gen Sarath Fonseka. Both men say they expect to win.
The former allies fell out after the war ended last year. Results are due on Wednesday. Turnout was over 60%.
BBC correspondents say with the ethnic Sinhalese vote split between the two men, Tamil and Muslim minorities could play a decisive part in the outcome.
If no candidate has 50% plus one vote after the first count, second preferences will be tallied and the candidate with the greatest number of votes wins.
After a violent and acrimonious campaign, many had feared the worst on election day.
AT THE SCENE
Ethirajan Anbarasan, BBC News, Colombo
Gun-wielding policemen were posted outside most polling stations while soldiers patrolled the streets. There were fears of violence on polling day.
Elderly women, nuns and professionals queued to cast their ballots. Sinhalese, Christians, Muslims and Tamils all came out to vote - reflecting the ethnic diversity of this island nation.
Some of the voters said this was a crucial election and that the country had to move on after the war. "We need to move forward, capitalise on whatever we have missed out on, and hopefully have a better future for all of us in Sri Lanka," said a businessman in Colombo.
Joy William, a poll monitor, said except for some stray incidents polling had been peaceful and brisk.
Soon Sri Lankan political leaders will know whether the voters have chosen continuity or change.
The two-month-long campaign left four people dead and hundreds wounded. Nearly 68,000 police were deployed to protect polling stations.
In the event, however, large numbers turned out to vote in a mostly peaceful atmosphere, says the BBC's Charles Haviland in Colombo.
But there were serious exceptions, especially in the Tamil-populated north. In the city of Jaffna, the private Centre for Monitoring Election Violence said there were at least six explosions before and just after voting began.
Later there were two blasts in Vavuniya, the town near the huge camps for people displaced by the war. The organisation said it feared this was a systematic attempt to scare people away from voting.
Reports from Jaffna suggested a low turnout there. Nonetheless, many displaced people did vote.
There were also grenade attacks in the Sinhala-dominated centre and south. Here the fight between the two candidates has been especially bitter, our correspondent says.
Among the early voters was President Rajapaksa.
President Mahinda Rajapaksa casts his vote
"Today's victory will be remarkable... We are getting ready to enjoy a better tomorrow," he told the news agency Reuters after voting in his rural constituency on the south coast.
In an unexpected twist, it later turned out that Gen Fonseka had not been able to vote because his name was not on the register.
State television put out a barrage of propaganda saying he had no right to be president, our correspondent says. But the Election Commission said there was no legal obstacle to the general assuming the post if he won.
"The government is trying to use this to mislead the public at the last minute," the general said.
Foreign Minister Rohitha Bogollagama said the government was seeking a ruling from the courts.
About 14 million voters were eligible to choose between 22 candidates. The frontrunners by far are President Rajapaksa and Gen Fonseka.
I was keen to have a say in who should be our next president
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.