Some critics feared a victory by Mr. Prabowo could turn the clock back toward authoritarian rule.
As a lieutenant general during the Suharto era, Mr. Prabowo, 67, commanded the feared Special Forces and was later dismissed from the army for insubordination and the kidnapping of at least nine activists who opposed his father-in-law’s rule.
In this election, Mr. Prabowo sought support from Islamists eager to expand the role of Islam in daily life, like by requiring women and girls to wear hijabs in public.
To counter Mr. Prabowo’s appeal to such Muslims, Mr. Joko named a conservative cleric, Ma’ruf Amin, as his running mate and made a pilgrimage to Mecca this week to remind voters of his piety.
At a polling station in central Jakarta, Trianasari Arief, 44, said she was excited to vote for Mr. Joko and wanted to do her part to keep Mr. Prabowo from winning. She said the ex-general, known for his quick temper and unpredictable behavior, reminded her of President Trump and his upset victory in 2016.
“I don’t want what happened in the United States to happen in Indonesia — where people don’t go to vote and they get the orange-skin guy into office,” Ms. Trianasari said.
But Mr. Prabowo’s anti-elitist message did win favor among some voters. Sri Lestari, 42, a nanny in the affluent Menteng neighborhood, said Mr. Joko had not done enough to bring fairness to the judicial system, resolve human rights cases or unify the people.