0442 GMT June 19, 2019
The result was released a day ahead of schedule in the early hours of Tuesday, amid fears of unrest, BBC reported.
Around 32,000 security personnel were deployed across the capital Jakarta, AFP news agency reports.
Prabowo rejected the result and said he would pursue "legal avenues", but urged his supporters to stay calm.
Ahead of the final tally he had alleged "widespread cheating" and warned of potential street protests. In 2014, Prabowo challenged an election defeat by Widodo in Indonesia's constitutional court, but lost.
The latest vote followed a bitter campaign, but independent observers have said it was free and fair.
Widodo won 55.5 percent of the vote to Prabowo's 44.5 percent, the election commission said. More than 192 million people were eligible to vote in the April 17 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.
Situation on the ground
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 Daesh, 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.
Widodo has been president since 2014 when he also beat Prabowo in a hotly-contested vote.
The 57-year old comes from humble beginnings and has focused his campaigns very much around his image as a "man of the people".
He first came to international prominence by becoming governor of Jakarta in 2012.
Under his presidency, Indonesia's economy has grown steadily.