Iranians voted in unexpectedly large numbers on Friday in the first polls since last summer’s landmark nuclear agreement and the lifting of sanctions.

The election was a key test of whether supporters of Hassan Rouhani, the president, can gain ground from conservatives and anti-western hardliners.

Voting was extended for five hours in the evening because of what state TV described as a “rush” that caused shortages of ballot papers.

Experts say a high turnout – widely predicted to hit 70% – will favour the Rouhani camp. The president himself spoke of an “epic” turnout after casting his vote.

Polling stations across Tehran were busy into Friday evening, fuelling hopes for a good result for the reformist-moderate alliance and increased support for Rouhani in the 290-seat parliament, or Majlis.

A parallel contest is taking place for the assembly of experts, a clerical body whose 88 members have to choose the next supreme leader after the 76-year-old Ayatollah Ali Khamenei.

In Baharestan Square, a religious area near the capital’s famous bazaar, a young couple emerged from a polling station to say that everyone they knew was voting – despite fears of apathy.

State TV broadcast pictures of queues of voters across the country – emphasising its size and diversity from Kurdistan in the north to Baluchistan in the east.

Khamenei cast his ballot moments after the polls opened at 8am, waving to a phalanx of cameras and urging citizens to follow his example.

“It is our duty and our right to take part in these elections and that’s why I came early in the morning,” he said. “My advice to everybody who loves the Islamic Republic of Iran and our great nation is to try to vote very soon.”

“Turnout has been very satisfactory so far,” said Alireza Seyfan, supervising the vote in the Imam Hassan mosque in Narmak in east Tehran, as a couple of dozen people filled out their ballot papers – each requiring a handwritten list of 30 candidates.

Papers have to be marked by a fingerprint and countersigned by a supervisor before being placed in a plastic box.

Iran’s president, Hassan Rouhani, waves to the media after casting his vote in Tehran. Photograph: AP

Crowds gathered in the winter sunshine on nearby Hafthoze Square, where a giant banner quoted Khamenei: “People should elect those who are not connected to the sources of wealth and power.”

In Samangan, home to the former president Mahmoud Ahmadinejad, dozens waited outside the Great Mosque a good hour before polling began.

“The economy and inflation are the main issue for me,” said Farsheed, a 24-year-old bank employee. He was backing the pro-Rouhani reformist “list of hope” of Mohammad Reza Aref, a former vice-president and ally of Mir Hossein Mousavi and Mehdi Karroubi, the Green Movement leaders whose victory in 2009 was “stolen” by Ahmadinejad – and who remain under house arrest.

Zahra, a mother of two teenage sons, was supporting the rival conservative list led by Gholam-Ali Haddad-Adel, a close confidant of Khamenei.

“I want him because he supports the supreme leader,” said the 42-year-old, whose chief concern was youth employment. Neither she nor her husband, Mortaza, had seen any improvement in the economy since the lifting of sanctions last month.

In Niavaran in opulent north Tehran, overlooked by the snowcapped Alborz mountains, 200 people queued up at lunchtime to vote at the Val-Fajr mosque, men and women in segregated lines straggling across the courtyard.

“The most important thing for me is to stop the radical right getting into the Majlis,” explained Nargis, a computer programmer. “We hope that this time our votes will count – not like what happened in 2009.”

Reformist supporters attach greater importance to parliament than to the assembly of experts, which has a built-in majority for conservatives. Still, close attention is being paid to the performance of Ayatollah Akbar Hashemi Rafsanjani, the former president, who has thrown his weight behind Rouhani.

Elsewhere crowds chanted the name of Mohammed Khatami, the highly regarded reformist president of the late 1990s, whose photograph is formally banned.

Iranian officials were keen to advertise the election as another reason for the outside world to engage with this country in the wake of the nuclear agreement.

“This is a message to the west – that we have democracy based on Islamic values,” said Ali Bakhsi, a foreign ministry employee who was waiting to casting his vote.

Students from Amir Kabir university expressed strong support for Rouhani – as well as scepticism about whether the vote would change much.

“Iran is like a monarchy,” said Namira, a 22-year-old theatre student, her hair barely covered by the required headscarf.

“Instead of a shah we have a supreme leader. We have a Majlis, but it only has limited influence.”

Others complained about the disqualification of hundreds of candidates. “But weaker reformists are still better than hardliners,” an engineering student said.

An Iranian woman shows her inked finger after casting her ballot at a polling station in Tehran. Photograph: Atta Kenare/AFP/Getty Images

“I am optimistic about the result, even though there have been a lot of limitations,” the reformist commentator Saeed Laylaz told the Guardian.

“In parliament we expect to make up a strong minority. If we get 110-130 seats, that would be a victory. The regime will realise that we are strong – in spite of all the propaganda by the conservatives.”

In Ferdowsi Square, one poster was a reminder of the high tensions around the vote. “England is trying to interfere in Iran’s elections,” it said, over a picture of a camel with the face of the Queen.

No one is predicting trouble in the wake of the polls, though there is some nervousness in the reformist camp about the aftermath.

Several hundred foreign journalists who have been given rare visas to report on the elections have been ordered to leave by Sunday. Press passes were carefully scrutinised by security personnel guarding polling stations.

Full results are expected early next week.