Exit polls give Jakarta governor Joko Widodo a narrow lead in Indonesia's presidential election, in a tight race with ex-army general Prabowo Subianto.
Official results are not expected for two weeks but quick counts by pollsters - which are considered reliable - give Widodo a slim lead over his rival.
Based on the tallies, Widodo's party says he has won - but Prabowo's camp says it is too close to call.
The official tally is expected to be announced on 22 July.
Preliminary exit polls appear to show Widodo has a lead of at least four percentage points.
One exit poll led by Indonesia's oldest think tank CSIS Indonesia put him ahead with 52 percent of the vote, compared with Subianto who was on 48 percent.
Another poll led by news website Kompas.com had a similar result, while a third by Saiful Mujani Research and Consulting put Widodo on 52.76 percent and Subianto on 47.24 percent, according to agencies.
Widodo was quick to claim victory based on the exit polls - an hour later his rival also declared he had won.
Voting opened at 07:00 local time and closed at 13:00 local time. Indonesia has three times zones and the last ballots were cast just before 06:00GMT.
'RESPECT THE CHOICE'
Outgoing President Susilo Bambang Yudhoyono could not stand for another term as the constitution has a two-term limit. After casting his ballot, he urged all parties to respect the poll result.
"Our democracy is at a relatively mature state, and our people enjoy the freedom to choose," the outgoing leader said.
"Therefore, I hereby urge all the leaders and political elites in this country to respect the rights of the people, respect the freedom of the people to choose their leader."
Widodo, from the Indonesian Democratic Party of Struggle (PDI-P), is a popular figure with the public.
He is supported by young people in both urban and rural areas who see him as a clean politician in a country beset by corruption.
But critics say he lacks experience in national politics and international relations.
He is supported by Indonesia's most popular Islamic Party, the National Awakening Party (PKB), and the National Democrat Party (NasDem).
Alice Budisatrijo, BBC News, Jakarta:
A steady stream of people have been coming in to a polling station in the crowded Menteng neighbourhood in Jakarta. The population is so dense that there are four polling stations within a 300m radius.
Officials were not quite ready at 07:00 local time (23:00 GMT) when the booths were supposed to open. But early voters waited patiently as many people in the football-mad country stayed up all night watching the Germany-Brazil game.
Today's turn-out is expected to be high as this is a contest that has generated an unprecedented enthusiasm about the country's future leader. While the two candidates' visions for the country sound similar, their drastically different personalities have captivated and divided the nation.
The test for Indonesia's democracy will be when the results are announced. Patience and tolerance may be in shorter supply.
Subianto, from the Great Indonesia Movement Party (Gerindra), is seen as a convincing campaigner and a decisive man with good knowledge of defence, because of his military background.
He has, however, been dogged by allegations of human rights abuses committed during former dictator Suharto's regime, which ended in 1998.
In the final days of Suharto's rule, the unit which he commanded is accused of kidnapping, torturing and killing activists protesting against Suharto.
Subianto is supported by Golkar, which is Indonesia's second largest party. He is also endorsed by the Democratic Party (Demokrat) of current leader Susilo Bambang Yudhoyono.
Both campaigns have used nationalistic rhetoric on the economy, corruption and other domestic issues such as infrastructure and social security, but they have been less vocal on detailed policies on job creation and boosting economic growth.
Ahead of the vote, election officials delivered ballot boxes to polling stations around the country, ferrying them to Indonesia's numerous islands by speedboat, carrying them on horseback along mountain paths, and dropping them off at remote hamlets with helicopters and small planes.
Meanwhile in Jakarta the authorities deployed 22,300 policemen to keep the peace, reports say.
The new president will be inaugurated on 20 October and will have to appoint a cabinet within two weeks.