Updated at 10.20am

At least six people were killed as Indonesia's capital erupted in violence on Wednesday when police in riot gear clashed with protesters opposed to President Joko Widodo's re-election.

Dozens were arrested and parts of Jakarta were littered with debris and burned-out cars, as the violence triggered security advisories from the US and Australian embassies.

Authorities also restricted access to some social media in a bid to stop the spreading of rumours and fake news.

National police chief Tito Karnavian said six people had died, but denied authorities had fired live rounds on the crowd and called for calm.

"Some had gunshot wounds, some had blunt force wounds but we still need to clarify this," he told reporters.

About 20 people were arrested, he added.

A former special forces commander was earlier detained for trying to smuggle weapons into protests, according to the government.

A major commuter train station in the area had been temporarily shut, while roads were blocked off in parts of the sprawling city.

Some shopping malls, businesses and schools were also closed.

More than 30,000 troops had been deployed across Jakarta in anticipation of protests after official election results were published.

On Tuesday, Indonesia's election commission confirmed Widodo, 57, had beaten retired military general Prabowo Subianto for the presidency in a poll held on April 17.

Subianto has said he would challenge the results in court, and earlier warned that his claims of widespread cheating could spark street protests.

Several thousand people rallied in support of Subianto near the election supervisory agency office in the heart of the capital on Tuesday.

The protest ended peacefully, but then violent clashes broke out several hours later after some demonstrators returned to the scene.

Tensions have also spiked since police said last week that they had arrested dozens of Islamic State-linked terror suspects who had planned to cause chaos by bombing post-election protests.

Last month, a record 245,000 candidates ran for public office in Indonesia's elections, from the presidency and parliamentary seats to local positions - the first time all were held on the same day.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.