In some of Indonesia's most remote areas, election organisers carried ballots by boat or on horseback through mountains.
After the most polarising campaign in Indonesia's history, millions of people who voted yesterday to elect a new president will have to wait at least two weeks for an official result, due to the complexity of holding elections across the archipelago of more than 17,000 islands that spans three time zones.
But they may have to wait even longer because both candidates have claimed victory - setting the stage for an unprecedented constitutional battle.
The world's third-largest democracy is divided over two very different choices: Joko Widodo, a one-time furniture maker, and Prabowo Subianto, a wealthy ex-army general with close links to former dictator Suharto.
The only two other direct presidential elections since the downfall of Suharto in 1998 were won resoundingly by President Susilo Bambang Yudhoyono.
Just a couple of months ago, the election was considered firmly in favour of Widodo, who rose from humble beginnings to become the governor of Jakarta with a squeaky-clean political record.
But a late surge by Prabowo has vastly improved his chances after he wooed legions of supporters with calls for nationalism despite allegations of widespread human rights abuses during his military career and his connection with Suharto - his former father-in-law.
When the polls opened early yesterday to about 190 million people, analysts predicted that undecided voters would determine the winner.
Both candidates were mobbed by throngs of journalists and supporters as they made their way to polling stations.
Later, as a series of unofficial tallies, which are considered reliable, started to show Widodo with a lead of four to five percentage points, smiling, he declared victory flanked by members of his party, extending his thanks to "all the Indonesian people".
But shortly afterwards Prabowo also claimed victory. The 62-year-old, who has pushed a strongman image, said survey institutes used by his campaign team showed that he and running mate Hatta Rajasa "have received the support and mandate from the people of Indonesia".
Tobias Basuki, an analyst from the Jakarta-based Centre for Strategic and International Studies, described the situation as "unprecedented", adding: "We've never seen such polarisation in Indonesia."
Smear tactics have surfaced in both camps. But Widodo, 53, has blamed his fall in opinion polls from a lead of more than 12 percentage points in May to around 3.5 points, on character assaults that accused him of not being a follower of Islam.
"I think these black campaigns were effective enough to convince communities," said Hamdi Muluk, a political analyst from the University of Indonesia. "And that has directly ruined Widodo's image."
Voting first took place in the eastern Papua region, where ballots in mountain villages can sometimes be cast in open woven baskets for all to see.
"The community gets together and decides who they will vote for," said Andrew Thornley, Jakarta-based programme director for elections at non-profit organisation the Asia Foundation.
A similar traditional system of group voting can be found on Bali.
The most challenging areas, prone to spoiled ballots, disputes or fraud, include Papua, the Maluku Islands, and northern Sumatra, according to Ferry Kurnia, an elections commissioner.
The commission dismissed more than 200 organisers for not following procedures, Kurnia said.
Associated Press, Agence France-Presse, Bloomberg