Joko Widodo has been re-elected as Indonesia’s president after last month’s vote, beating former general Prabowo Subianto, Agencies report.
The result was released a day ahead of schedule in the early hours of Tuesday, amid fears of violent unrest.
Around 32,000 security personnel were deployed across the capital Jakarta, AFP news agency reports.
Mr Prabowo, 67, has not yet confirmed if he will challenge the result in court.
Ahead of the final tally he had alleged “widespread cheating” and warned of potential street protests. In 2014 Mr Prabowo lost a court challenge following an election defeat by Mr Widodo.
The latest vote followed a bitter campaign in which religion played a key role, but independent observers have said it was free and fair.
Mr Widodo won 55.5% of the vote to Mr Prabowo’s 44.5%, the election commission said. More than 192 million people were eligible to vote in the 17 April poll, choosing 20,000 local and national lawmakers.
Azis Subekti, a witness from the retired general’s campaign team, refused to sign the results.
“We won’t give up in the face of this injustice, cheating, lies, and these actions against democracy,” he said.
Authorities have appealed for calm and increased security measures in a bid to manage tensions.
Security personnel have been stationed in front of the election commission’s office, backed by razor wire and water cannon.
On Friday police said they had arrested dozens of suspected terrorists with links to Islamic State (IS), some of whom had allegedly planned to bomb political rallies when the vote result was released.
The same day, the US embassy issued a travel warning advising its citizens in Indonesia to avoid demonstrations and political gatherings.
The two rival election campaigns focused on the economy, infrastructure and corruption.
Religion was also a core issue. Though Indonesia has no official state religion and the right to practise other faiths is enshrined in the constitution, some 80% of the country is Muslim.
Conservative Muslim groups have grown increasingly vocal in recent years, and observers say the presidential candidates both sought to tout their Islamic credentials.
Mr Widodo, himself a religious moderate, picked powerful cleric Ma’ruf Amin as his running mate, while Mr Prabowo promised to protect Islamic leaders and increase funding for religious schools.