Moderates and reformists have made further gains in elections to Iran’s Assembly of Experts, which appoints Iran’s supreme leader.
President Hassan Rouhani and his allies won 15 of 16 seats allocated to Tehran, although votes for the rest of the country were still being counted.
However, prominent hardliner Ahmad Jannati was re-elected to the assembly.
The vote is seen as significant given that Supreme Leader Ayatollah Khamenei is 76 and has suffered ill-health.
In elections to Iran’s parliament that took place at the same time, allies of Mr Rouhani won all 30 seats allocated to the capital.
Supporters of the president had sought to prevent hardliners from being re-elected to the Assembly of Experts.
The assembly’s current chairman, Ayatollah Mohammad Yazdi, and another prominent figure, Ayatollah Mohammad Taghi Mesbah Yazdi – seen as the mentor to conservative former President Mahmoud Ahmadinejad – both lost their seats.
However, Mr Jannati retained his seat, finishing in 16th place in the capital. He is chairman of Iran’s Guardian Council, an unelected body that vets election candidates.
Ahead of the elections, the Guardian Council disqualified almost all the well-known reformist candidates and many moderate ones.
BBC Persian’s Amir Azimi says this made reformist leaders resort to the uncharted territory of backing a coalition list, asking their supporters to vote tactically.
Analysis: Lyse Doucet, BBC News international correspondent
This stunning election result will make a difference in Iran’s engagement with the wider world.
President Rouhani’s hand has been strengthened in parliament to help open his country to greater trade and investment. That will help him, and others in his reformist camp, to deepen the dialogue with the West, which began with negotiations on a landmark nuclear deal.
But much of this opening will continue to be with Europe, rather than the US. Iran’s relationship with America is still complex and controversial.
Iran’s ambitions in the region are also deeply rooted – it has strategic interests in countries like Syria, Iraq and Lebanon as well as Afghanistan, and a strong sense of its right to remain engaged. These are areas where Iran’s powerful Revolutionary Guards and its conservative Supreme leader hold sway.
But Iran wants to be regarded as an equal partner, able to sit at the world’s top tables to work on common threats like the so-called Islamic State. President Rouhani’s team may now feel empowered to engage a bit more, more often.
Hardliners have responded by accusing reformists of colluding with the West to block conservative appointments to the country’s Assembly of Experts.
Sadeq Larijani said reformists had worked with “American and English media outlets” during the poll.
“Is this type of co-ordination with foreigners in order to push out these figures from the Assembly of Experts in the interests of the regime?” he said in a statement.
It is the first time Iranians have gone to the poll since last year’s landmark nuclear deal and the lifting of international sanctions.
The parliamentary result in Tehran is significant because lawmakers from the capital usually determine the political direction of the house, analysts say.
But with a mixed vote outside the capital neither the reformist or hardliners are likely to have overall control of parliament.
Mr Rouhani said on Saturday that the election was an endorsement of his efforts to end Iran’s international isolation.
“The competition is over. It’s time to open a new chapter in Iran’s economic development based on domestic abilities and international opportunities,” the official Irna news agency quoted him as saying.
Despite securing the nuclear deal he has faced resistance at home to domestic reform.
Ayatollah Khamenei said the turnout, at 60%, showed “the brilliant face of religious democracy to the world”, Iran’s conservative Tasnim news agency reported.
But he also urged “vigilance” against what the agency called “foreign meddling”.
BBC Persian’s Ali Hamedani says the economy was a key issue in the process.
With sanctions lifted and Western investors beginning to return to Iran, there are high hopes for an improvement in daily life, he says.