JAKARTA -- Indonesia's Joko Widodo has won a second term as president, beating out rival Prabowo Subianto, a retired general, by a 55.5 percent to 44.5 percent margin, the elections commission said.
"This ruling was announced on May 21... and will be effectively immediately," the commission's chair Arief Budiman said in a live streamed announcement that was broadcast on major media.
The commission had been expected to announce the official results of the April 17 poll on Wednesday.
But amid fears about unrest and street demonstrations in response to the final count, the final tally was released early with little advance notice.
Widodo had been widely predicted to win according to unofficial results.
His challenger Subianto has vowed to challenge any victory for Widodo, alleging widespread voter fraud, and warned that it could spark street protests.
Some 32,000 security personnel were being deployed across the capital Jakarta, including in front of the General Elections Commission's downtown office which has been barricaded with razor wire.