Incumbent president Joko Widodo won last month's Indonesian election with 55.5% of votes against 44.5% for his challenger, retired general Prabowo Subianto, the election commission's official count said early on Tuesday.
The official result released by the General Election Commission (KPU) confirms unofficial counts by private pollsters of the 17 April election, giving Widodo a comfortable victory, though it could trigger a legal challenge and potential street protests after Prabowo claimed widespread cheating.
Widodo won with over 85 million of the total 154 million votes cast in the world's third-largest democracy. There was no immediate reaction from him or his campaign team.
An election supervisory agency earlier on Monday dismissed claims of systematic cheating because of a lack of evidence and independent observers and analysts have said the poll was free and fair.
But a witness for Prabowo's campaign team and the leading opposition party refused to sign and validate the official results, which were announced more than a day earlier than expected after the KPU worked into the early hours of Tuesday to finish the vote count.
"We won't give up in the face of this injustice, cheating, lies, and these actions against democracy," said Azis Subekti, a witness from Prabowo's campaign team.
It was not immediately clear if Prabowo would mount a legal challenge to the official result.
Authorities have tightened security in anticipation of potential civil unrest and have detained dozens of militant Islamists suspected of planning attacks to create mayhem during demonstrations.
Police rolled out barbed wire and readied armoured trucks and water cannons around the KPU. They have also prevented people from across Indonesia travelling to Jakarta en masse to join protests.
Prabowo has said the situation could trigger "people power"-style protests, while the government and police have urged protesters to keep the peace and vowed action against anyone stirring unrest.
National police, who report directly to Widodo, have also held or interrogated at least three leading opposition figures for suspected treason.
The streets outside the KPU were quiet immediately after the announcement.
Last week, police said they had detained about 30 suspected militants with ties to Jemaah Ansharut Daulah (JAD), Indonesia's largest group linked to Islamic State.
The losing party can lodge a legal challenge at the constitutional court. Otherwise, the commission will officially declare the winner by 28 May.
Prabowo has not yet confirmed if he intends to go to court, but his challenge to his 2014 defeat by Widodo was rejected.