Sri Lanka’s ruling party presidential candidate, housing minister Sajith Premadasa, conceded defeat to Mr Rajapaksa, saying he would honour the decision of the people.
Mr Rajapaksa, the campaign front-runner who served as defence secretary under his brother, ex-president Mahinda Rajapaksa, pledged to restore security to the Indian Ocean island nation still recovering from terror attacks last Easter.
Mr Rajapaksa announced his candidacy shortly after the terrorist attack where militants linked to the so-called Islamic State group targeted churches and high-end hotels across the island on Easter Sunday, killing 269 people.
Mr Rajapaksa criticised the government for intelligence lapses and letting the security sector falter.
His victory in Saturday’s vote marks the return of a family ousted from power in 2015 elections amid constant reports of nepotism, skimming off development deals with China and alleged human rights violations during the end of the decades-long war with the Tamil Tiger rebels in 2009.
The election also mirrors the global trend of populist strongmen appealing to disgruntled majorities amid rising ethno-nationalism.
“As we usher in a new journey for Sri Lanka, we must remember that all Sri Lankans are part of this journey. Let us rejoice peacefully, with dignity and discipline,” Mr Rajapaksa tweeted.
About 15 million people were eligible to vote, and Sri Lanka’s Election Commission estimated 80% turnout after polls closed.
Flanked by Buddhist monks at campaign events, Mr Rajapaksa focused his message on Sri Lanka’s majority Sinhala Buddhist population, who comprise about 70% of the island’s citizens. The second-largest group are ethnic Tamil Hindus at 12.6%, while 10% are Muslims and 8% are Christian.
He accepted support from Buddhist nationalist clerics who demanded the resignation of Muslim Cabinet members and governors they said were interfering with the investigation of the Easter attacks.
The Muslim politicians temporarily stepped aside.
The campaign said Mr Rajapaksa’s swearing-in ceremony would take place at Anuradhapura, a city about 124 miles from Colombo and the seat of the first Sinhalese kingdom known for a sacred tree that is said to be the southern branch of the Bodhi tree in India under which Lord Buddha attained enlightenment.
Though counting continued, the preliminary result reflected voting along ethnic lines, showing “a badly polarised country” that will embolden right-wing Buddhist clerics, said Kusal Perera, a political analyst and independent journalist.
“A Sinhala Buddhist theocratic state has been given a people’s mandate now,” he said.
Mr Premadasa swept the majority Tamil and Muslim districts in the country’s north and east, winning as much as 80% of the vote. In majority ethnic Sinhala areas, Mr Gotabaya secured around 60%.
Sinhala Buddhists’ votes usually do not vote as a bloc, unlike Sri Lankan minorities who have supported whatever party espoused policies comparatively favourable to them.