Mahinda Rajapakse appeared assured of victory when he called snap polls in November, seeking an unprecedented third term five years after crushing a violent separatist rebellion that had traumatised the country for decades.
But he has more recently been dogged by accusations of increasing authoritarianism and corruption and a failure to bring about national reconciliation.
His health minister Maithripala Sirisena's shock decision to defect from the government and stand against the president led to a bitterly fought campaign for an election analysts say is too close to call.
Rajapakse said he was confident of a "resounding victory" and promised a peaceful post-election period as he cast his ballot.
With independent monitors warning of voter intimidation, top US diplomat John Kerry this week urged Rajapakse to ensure the election was peaceful and credible.
Opposition supporters have accused the government of deploying troops to ethnic Tamil-dominated areas including the northern Jaffna peninsula, where the president is widely disliked.
A loud explosion was heard outside a polling station in Jaffna early Thursday in what Tamil leaders said was an attempt to deter voting, but there were indications turnout was unusually high.
"We are seeing heightened enthusiasm among minorities," head of the Campaign for Free and Fair Elections, Keerthi Thennakoon, told AFP.
Tamil translator S. Sebanayagam said he had to wait in line to cast his vote in Jaffna.
"There were lots of people ahead of me, including some very elderly people who seemed keen to vote," Sebanayagam told AFP.
Tamils are Sri Lanka's largest minority, accounting for 13 percent of the population, and could decide the election if the majority Sinhalese vote is split between Rajapakse and his main opponent.
Sirisena was a relative unknown until he announced he was standing as the main opposition candidate, but his decision to run against the incumbent has led a slew of defections and become a rallying point for disaffection with Rajapakse and his powerful family.
"My victory is in sight. There is support for us everywhere," said Sirisena as he cast his vote, promising a "new political culture".
Rajapakse is South Asia's longest-serving leader and had appeared politically invincible after his forces crushed the Tamil Tigers in 2009 and brought peace to the island.
He won a landslide election victory in 2010, but critics say he has failed to bring about reconciliation with Sri Lanka's Tamil minority in the years that followed.
Critics say he has overseen a period of rampant corruption, undermining the independence of the judiciary and lining the pockets of political cronies through lucrative contracts.
The 69-year-old president removed the two-term limit on the presidency and gave himself more powers soon after winning his second term.
He has packed the government with relatives, sparking resentment even within his own party.
Opposition groups including the main Tamil party have rallied behind Sirisena, a 63-year-old farmer-turned-politician who, like Rajapakse, is from the majority Sinhalese community.
The president has taken drastic measures to shore up support, slashing fuel prices, cutting water and electricity tariffs and giving subsidised motorcycles and hefty pay increases to 1.6 million public servants.
Sri Lanka's economy has grown by an annual average of over seven percent since the war ended, partly thanks to hefty investment from China.
But the opposition says Chinese contractors have employed few local people, and household incomes have not kept pace with national growth rates.
Rajapakse has also promised a judicial inquiry into allegations troops killed 40,000 Tamil civilians at the end of the civil war, although he still refuses to cooperate with a UN-mandated investigation.
The election comes days ahead of a visit to the island by Pope Francis that is expected to focus on reconciliation, and the Catholic Church has expressed concern that his trip could become politicised.
Sri Lanka is a mainly Buddhist country, but has sizeable Hindu, Muslim and Christian minorities.
The independent Centre for Monitoring Election Violence said this week it had documented 420 incidences of violence during the campaign, with the north worst hit.
On Wednesday, police said an opposition activist had died after being hit in a drive-by shooting at a rally for Sirisena.
Polls opened at 7 am local time for nine hours of voting under tight security, an elections department official said. There are 19 candidates in all with results expected Friday.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ