Police fire tear gas at protesters in Tanah Abang, Jakarta, Indonesia.

Demonstrations over the outcome of last month's presidential election gripped the heart of Indonesia's capital on Wednesday after an overnight face-off between police and protesters in which, according to Jakarta's governor, six people were killed.

The protests followed an announcement before dawn on Tuesday by the election commission confirming that President Joko Widodo had beaten his challenger, former general Prabowo Subianto, in the April 17 poll.

Crowds swelled in central Jakarta on Wednesday morning and police said they expected more protesters to join them before nightfall. Some of those arriving carried wooden poles and some had smeared toothpaste around their eyes, apparently to protect themselves from tear gas.

The majority of the protesters appeared to have come from outside Jakarta and police found envelopes containing money on some of the people they searched, National Police spokesman Muhamad Iqbal told a news conference.

"This is not a spontaneous incident, this is something by design. There are indications that the mobs are paid and bent on causing chaos," he said.

Hundreds of students also protested peacefully in the city of Medan, in the north of the island of Sumatra, demanding an investigation into alleged election cheating, TVOne reported.

"WE KNOW WHO IS BEHIND THIS"

The General Election Commission (KPU) on Tuesday confirmed unofficial counts by private pollsters that gave Widodo a 55.5% share of votes against 44.5% Prabowo.

Widodo won more than 85 million votes of 154 million cast in the world's third-largest democracy, but retired general Prabowo has alleged "massive cheating and irregularities".

Prabowo's legal director has said his campaign plans to contest the result in the Constitutional Court. Prabowo also launched a legal challenge after he was defeated in the 2014 election by Widodo, which was rejected.

On Monday, an election supervisory agency dismissed claims of systematic cheating, citing a lack of evidence. Independent observers have said the poll was free and fair.

Analysts have said Widodo's double-digit margin of victory means the opposition does not have a strong case to claim the election was rigged, but Islamist supporters of Prabowo could cause considerable disruption.

Islamist groups, many of which support Prabowo, have in the past been able to mobilise hundreds of thousands of supporters.

From late 2016, they organised a series of protests against then-Jakarta governor Basuki Tjahaja Purnama, the first ethnic-Chinese Christian to hold the job, who was subsequently jailed for insulting the Koran.

Presidential Chief of Staff Moeldoko said he believed there was "a systematic effort by a certain group ... that is riding on the situation to muddy the situation", adding that authorities had seized two pistols from people involved in riots. "We know who is behind this, it is a matter of time."

Protests that began calmly in the sprawling textile market neighbourhood of Tanah Abang on Tuesday turned violent after nightfall, with police firing tear gas to disperse the crowd.

Jakarta Governor Anies Baswedan told TVOne that by the morning six people had died and 200 people had been wounded.

News website Tirto reported a man died of bullet wounds in Tanah Abang, quoting a doctor at a hospital near the site.

SOCIAL MEDIA BLOCK

Fadli Zon, deputy chairman of Gerindra, Prabowo's political party, accused police of initiating an attack on protesters and said he found 171 bullets, including live rounds, when he visited the area on Wednesday morning.

"The public have a right to demonstrate. They are people who are concerned by cheating. They are not mobilised, paid or facilitated," Zon said.

Prabowo campaign spokesman Dahnil Azar Simanjuntak called on "all sides to hold back and not commit violence".

Police spokesman Dedi Prasetyo said that security forces on the ground, including military personnel, were not armed with live bullets.

Indonesian authorities say 40,000 police and army personnel are on duty across Jakarta to maintain security.

Television footage showed smoke billowing from behind dozens of protesters in the streets of Tanah Abang on Wednesday, with some throwing firecrackers and tearing down public fences.

Many office buildings, businesses and embassies in downtown Jakarta were closed, as were train stations in the area.

Hundreds of police in riot gear blocked the usually busy Sarinah intersection to hold back a crowd they said was expected to swell further in the afternoon.

Chief security minister Wiranto said the government would temporarily block certain social media functions to prevent inflammatory hoaxes and fake news.

Australia, the United States, and Britain issued travel alerts warning of an increased risk of violence across Indonesia and advising citizens to stay away from protests.