Joko Widodo, Indonesia's first leader from outside the political and military elite, was sworn in as president Monday and reached out to political foes to seek support for his ambitious reform agenda.

The inauguration, which was attended by foreign dignitaries including US Secretary of State John Kerry and Australian Prime Minister Tony Abbott, capped a remarkable rise for the softly-spoken politician who was brought up in a riverside slum.

Widodo, known by his nickname Jokowi, won the presidency in July after a close race against controversial ex-general Prabowo Subianto.

He is the country's first leader since the end of Suharto's three decades of dictatorship in 1998 to have no major links to that era.

Hopes are high for a new style of leadership in the world's third-biggest democracy, but there are also fears an opposition-dominated parliament could make it hard for Widodo to enact reforms to revive the G20 economy and help society's poorest.

After taking the oath in parliament, Widodo travelled through Jakarta on a horse-drawn carriage, waving to huge crowds, before arriving at the presidential palace where he watched a military parade with outgoing leader Susilo Bambang Yudhoyono.

In his inauguration speech to the legislature, he called for unity following the most bitterly fought election in Indonesian history.

"Unity and working hand in hand are prerequisites for us to be a great nation," said the 53-year-old former furniture exporter, who won legions of fans during his time as Jakarta governor. "We will never become a great nation if we are stuck with division."

"This is a historic moment for us all to move together, to work and work," the president urged.

The new leader also referred to Prabowo as "my best friend" during the speech, and the ex-general responded by standing up and giving a salute, the latest sign of a thaw between the pair after recent tensions.

- Colourful celebrations -

Tens of thousands were lining the streets of Jakarta to celebrate the inauguration, with flag-waving crowds screaming "Jokowi, Jokowi!" as the new president passed by in the carriage along with new Vice President Jusuf Kalla.

A colourful parade that featured bands and dancers in outfits accompanied Widodo to the palace, and in the evening the heavy metal fan is expected to join rock bands on stage at an outdoor concert.

About 24,000 police and military personnel were deployed to secure the day's events.

But the euphoria of the inauguration is likely to be short-lived as Widodo faces up to the task of leading the world's fourth most populous country, with 250 million people spread over more than 17,000 islands, at a critical moment.

Southeast Asia's top economy is growing at five-year lows, corruption remains rampant and fears are mounting that support for the Islamic State group could spawn a new generation of radicals in the world's most populous Muslim-majority country.

Kerry's attendance was in part aimed at seeking support from Indonesia and other Southeast Asian nations in the fight against the extremists, who have taken over vast swathes of Iraq and Syria.

During a meeting later Monday, Kerry also planned to encourage Widodo to ensure Indonesia, a major player in regional diplomacy, paid adequate attention to foreign affairs. There have been concerns that the new president will focus solely on domestic issues.

Widodo's first test will be to reduce the huge fuel subsidies that eat up about a fifth of the nation's budget, a move which economists say is urgently needed but which risks sparking large street protests.

Prospects for his ambitious reforms dimmed in recent weeks after Prabowo's supporters in parliament used their majority to abolish the direct election of local leaders, a move opposed by Widodo, and to win key posts in the legislature.

Prabowo's appearance at the inauguration and an unexpected meeting with Widodo Friday during which he pledged support have raised hopes that tensions are easing. But observers say the ex-general may still oppose the new leader's policies.

Widodo is expected to announce his new cabinet later in the week.