Joko Widodo, who captured the hearts of millions of Indonesians with his common man image, has been declared the winner of the country's presidential election with 53 percent of the vote.

As a grinning Widodo, dressed in a traditional Indonesian patterned shirt, looked on, the election commission announced on Tuesday that he had beaten Prabowo Subianto by more than six percentage points in the fight to lead the world's third-biggest democracy.

Widodo received 70,997,859 votes, or 53.15 percent of the nearly 133 million valid ballots cast, while his main rival Prabowo got 62,576,444 votes, or 46.85 percent.

"I want to declare that we, the party that supports and puts forward Joko Widodo and Jusuf Kalla (for vice president), has won," party chairwoman and former president Megawati Sukarnoputri told a news conference just before the announcement.

The news came after a dramatic final day to the country's most divisive election period since democracy was revived in 1998, with Prabowo angrily accusing Widodo's team of committing fraud and announcing his withdrawal from the presidential race.

Prabowo had repeatedly claimed that polling firms with links to his campaign showed that he was ahead.

Both candidates claimed victory on the day of the July 9 election, despite reliable polling agencies predicting a win for Widodo.

Widodo, a former furniture exporter known to most as "Jokowi," is the first candidate in a direct presidential election with no ties to the former dictator Suharto, who ruled for 30 years before being overthrown in 1998.

Jokowi will take office in October to serve a five-year term.

Al Jazeera's Step Vaessen, reporting from Jakarta, said security was tight outside the election commission.

About 3,400 policemen were deployed to guard the commission's building in Jakarta's town centre as commissioners and witnesses representing both sides finalised the vote count.

To many Indonesians, Jokowi, 53, represents a clean break from the old elite that have clung to power.

"Jokowi's the first genuinely post-Suharto figure (while) everybody else comes from that era, including Prabowo," said Paul Rowland, a Jakarta-based political analyst.