He was raised in a bamboo shack in a riverbank slum on Indonesia's main island of Java.

Now Joko Widodo will become the country's next president, a remarkable rise for the down-to-earth outsider in a political scene long dominated by aloof dynasties and elites from the era of dictator Suharto.

Final results showed that Widodo, known by his nickname Jokowi, won the closely-fought election on July 9 against ex-general Prabowo Subianto, with 53 percent to 47 percent.

Prabowo earlier said he was withdrawing from the race alleging massive fraud, although most independent analysts have said that the election has largely been free and fair.

Widodo, a former furniture exporter, shot to prominence when he was elected governor of the capital Jakarta in 2012 following a successful stint as mayor of his hometown Solo, on Java.

His hands-on-approach proved wildly popular with a public weary of corrupt and aloof politicians.

He regularly tours the teeming slums of the sprawling capital, which has a population of around 10 million, in casual clothes, and does impromptu check-ups on officials to ensure they are doing their jobs.

Despite his heavy workload, the father-of-three still takes time out to indulge his love of heavy metal, and is on occasion spotted headbanging at concerts in Jakarta.

His humble demeanour is a stark contrast to the political dynasties and ex-military figures with deep roots in the Suharto era who have dominated Indonesian politics since the end of the dictator's three-decade rule in 1998.

Outgoing President Susilo Bambang Yudhoyono is a former general, and Prabowo was a top military figure under Suharto who has admitted ordering the abduction of democracy activists.

New style of leader

"This is something new for Indonesians -- to have a leader who is also a grounded figure," said Tobias Basuki, an analyst with the Jakarta-based Centre for Strategic and International Studies.

Widodo completed a forestry programme at an Indonesian university, started up his own successful furniture business, and then entered politics in 2005 as mayor of Solo.

He is credited with regenerating the city during seven years in charge, moving slum dwellers into multi-storey flats with working toilets, and relocating hundreds of vendors clogging footpaths to a market.

During his time in charge in the capital, construction started on several new public transport projects aimed at easing chronic traffic jams. He also pushed a series of pro-poor policies, such as easier access to free healthcare.

Foreign investors will be relieved at a victory for Widodo, with markets rising whenever there is positive news about his presidential run. They believe he will be easy to work with and is more likely to introduce much-needed economic reforms.

His time leading the capital has not been without criticism, however, with many of the projects he initiated in Jakarta nowhere near finished after such a short stint in charge.

There are also marked doubts that the slightly-built, soft-spoken man is ready to lead the world's biggest archipelago nation, after never having had a role in national politics.