The contest on Friday offers distinct choices. Rafsanjani, 70, is a moderate who served as president from 1989-97. His rival Mahmoud Ahmadinejad, 49, is untested as a national political figure and has the backing of Iran's ruling clerics and their military guardians.
The counting ended Friday with 29.3 million votes cast, Rafsanjani took 6.1 million or 21 percent of the vote. Ahmadinejad took 5.7 million votes or 19.48 percent. Former Parliament speaker Mahdi Karroubi lost the No. 12 spot by a whisper with 5.6 million votes or 19.3 percent of the vote.
Friday's voting turnout of 62.7 percent was a resounding rejection of a youth-led boycott--with lines of voters forcing polling to continue four hours overtime. Iran's hard-line leaders crowed that U.S. President George Bush helped fuel the turnout by sharply criticizing the elections as undemocratic and angering many Iranians.
Iran has 46.7 million eligible voters, including millions of them living overseas.
Ahmadinejad, who surprised analysts with his strong performance, reportedly had the support of Iran's most hard-line factions, including the Revolutionary Guards.
Karroubi, who was popular in rural areas, accused Revolutionary Guards and their civilian vigilante wings of intimidating voters and appealed for an investigation.
Karroubi is a close ally of Iran's Supreme Leader Ayatollah Ali Khamenei, who heads the non-elected theocracy that can overrule the president or parliament.
The reformist Mustofa Moin, a former culture minister, had been seen as a strong possibility to enter the second round against Rafsanjani. But on Saturday, he fell to the bottom of the heap along with Bagher Qalibaf, a former head of the national police and another hopeful for the second spot.
The second round of voting takes place next Friday because no one candidate was able to get the required 51 percent of the popular vote for an outright victory.
During the campaign, Rafsanjani, who was president between 1989 and 1997, portrayed himself as a steady hand at the helm, able to navigate Iran through the treacherous days ahead, fraught with uncertainty over the nuclear program, relations with the United States and neighboring Iraq.
A day before the election, Bush sharply denounced the vote, saying it was designed to keep power in the hands of the clerics. But some Iranians said they were motivated to vote to retaliate against Bush's denunciations.
"I picked Ahmadinejad to slap America in the face," said Mahdi Mirmalek after attending Friday prayers at Tehran University.
At Tehran University, the leader of Friday prayers, Ayatollah Mohammad Emami Kashani, told worshippers that voting "strengthens the pillars of the ruling Islamic establishment." Followers then joined in with the common chant of "Death to America!"
The United States accuses Iran of using nuclear technology as a cover to develop atomic arms. Iran insists it aims only for electricity-producing reactors. Iran has suspended uranium-enrichment work during ongoing talks with European envoys.
Iran and the United States have had no diplomatic ties since 1979 when Iranian militants stormed the U.S. Embassy and kept 52 Americans hostage for 444 days.