Mahinda Rajapaksa, in office since 2005, called the election two years early with analysts predicting an easy win.
However, many voters have since rallied behind the challenger, former health minister Maithripala Sirisena.
There were armed policemen at every polling station because of concerns the vote would not be peaceful and free.
Mahinda Rajapaksa rode a wave of popularity after the civil war ended in 2009 but he now faces claims of cronyism.
His relatives fill many of the most powerful and influential positions in the country, and critics accuse him of running the state like a family business.
Analysts say Maithripala Sirisena appears to have capitalized on this perception, making gains among Sinhalese who usually vote for Mahinda Rajapaksa.
Maithripala Sirisena is also expected to win most of the vote from the ethnic minorities that make up about 30% of Sri Lanka’s population.
Mahinda Rajapaksa, however, remains hugely popular with many in the Sinhalese majority.
Casting his ballot in his constituency on January 8, the president said he was confident he would be given the leadership of the country for the third time.
“We will have a resounding victory. That is very clear. From tomorrow, we will start implementing our manifesto,” he told reporters according to the AFP news agency.
He has presided over a period of impressive economic growth and still has political capital from being the leader who brought an end to the war.
Sri Lanka is split along ethnic lines and Tamil rebels launched a campaign for a separate state in 1972.
The Rajapaksa government crushed the rebellion, but only after a bloody conflict had killed thousands of people.
Both sides in the 26-year civil war have been accused of atrocities.
The government has always denied allegations that many thousands of civilians were killed during the army’s final assault on Tamil Tiger rebels.
The run-up to the current election – the second presidential poll since the war ended – was marred by violence and allegations of intimidation.
On January 7, an opposition activist died a day after being shot while organizing a rally.
Voters in the Tamil-dominated northern city of Jaffna said there was a loud bang as polling stations opened, with some reports claiming a grenade had been thrown.
But observers said that voting had been broadly peaceful across the island.
Mahinda Rajapaksa was last elected in 2010 when he defeated his former army chief Sarath Fonseka, who was later jailed on charges of implicating the government in war crimes.
Polling stations opened at 07:00AM on January 8, and results are expected on January 9.
MIvEzURzRQQImage source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…