(CNN) Indonesian president Joko Widodo has won a second term as leader of the world's third largest democracy, official results confirmed Tuesday, beating a former general who has claimed widespread ballot-rigging.

Joko -- known as Jokowi -- won 55.5% of the vote in last month's general election while his longtime rival Prabowo Subianto took 44.5%, according to the General Elections Commission. Jokowi, 57, outperformed his 67-year-old strongman opponent in 21 of the country's 34 provinces, according to CNN Indonesia.

The results are in line with the early "quick count" results, which put the charismatic Jokowi on course to win a second five-year term. The results also mean Ma'ruf Amin, an Islamic cleric and Jokowi's 76-year-old running mate, will become Vice President.

Prabowo plans to challenge the election results by filing a lawsuit with the Constitutional Court, his campaign staffer Sufmi Dasco Ahmad said Tuesday.

Once the election commission finalizes the results Wednesday, Prabowo's camp has three days to file the lawsuit contesting the outcome. Prabowo, who with 44.5% support won over 68 million votes , had said before the official announcement that he would reject the result, if it went against him.

Read More