By Samia Nakhoul

TEHRAN (Reuters) - President Hassan Rouhani won a resounding vote of confidence and reformist allies won 29 out of Tehran's 30 parliamentary seats in elections that could speed Iran's post-sanctions opening to the world, early results released on Saturday showed.

Tens of millions thronged polling stations on Friday for a twin vote for the 290-seat parliament and the 88-member Assembly of Experts, which selects the country's highest authority, the supreme leader.

President Rouhani's reformist allies made gains in the races for parliament and the assembly, both in the hands of anti-Western hardliners for years. He said Iran's election had given the government more credibility and clout.

“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. He added that the government would cooperate with anyone elected to build Iran's future.

"The people showed their power once again and gave more credibility and strength to their elected government."

Rouhani and key ally and former president Akbar Hashemi Rafsanjani were leading the race for the Assembly of Experts with most votes counted and appeared to be sure of winning seats, early results released on Saturday showed.

The assembly results were initially announced as final in an official statement. A later statement said the results were partial and a final tally would be announced in due course.

An interior ministry statement said top reformist Mohammed Reza Aref led the race for parliamentary seats among candidates in Tehran. Aref was followed by five other reformists. Seventh on the list was a senior conservative, results showed.

Aref, a Stanford-educated former presidential candidate and minister, who served as vice-president to the former reformist President Mohammad Khatami, led the reformist list in the contest in Tehran, where more than 1,000 candidates are competing for just 30 seats in parliament.

Story continues

The elections were seen by analysts as a potential turning point for Iran, where nearly 60 percent of the 80 million population is under 30. http://tmsnrt.rs/20VK0vG

The contests were the first since a landmark nuclear deal last year that led to the removal of most of the sanctions that have damaged the economy over the past decade.

Supporters of Rouhani, who championed the nuclear deal, were pitted against hardliners close to Supreme Leader Ayatollah Ali Khameni, who are deeply wary of detente with Western countries. The conservative Guardian Council had restricted both races by disqualifying most reformist and many moderate candidates.

Even if reformists do not emerge with a national majority in the legislature, dominated since 2004 by conservatives, analysts say they will secure a bigger presence than before.

Conservatives usually perform well in the countryside while young town-dwellers tend to prefer moderate candidates.

HIGH REFORMIST HOPES

Reformists seeking more social and economic freedoms and diplomatic engagement had voiced high hopes of expanding their sway in parliament and easing conservative clerics' grip on the experts' assembly.

Saeed Leylaz, a political analyst and economist who served as an adviser to former President Mohammad Khatami, said initial indications were beyond reformist expectations.

"It seems the number of candidates who belong to the reformist and independent groups will be the majority in parliament and I am hopeful that the new parliament will be perfect for us," he told Reuters.

"In the Assembly of Experts our initial expectation was 15 to 20 percent but it seems it will be beyond that."

Rafsanjani, 81, a prominent leader ever since Iran's 1979 Islamic revolution, called for national unity now the divisive campaign was over. "The competition is over and the phase of unity and cooperation has arrived," state news agency IRNA quoted him as saying. "The time after elections is the time for hard work to build the country."

Newspapers hailed what they saw as a huge turnout, including many young voters. Polling was extended five times for a total of almost six extra hours because so many people wanted to vote.

Iran's Financial Tribune newspaper said three million first-time voters were among the nearly 55 million people aged 18 and over who are eligible to cast ballots.

Interior Ministry spokesman Hosseinali Amiri said more than 33 million votes had been cast but that tally was not final. It would probably take three days to count all the votes, he said.

MOUSAVI VOTES

Authorities had promised that all Iranians would be able to vote and on Friday opposition leader Mir Hossein Mousavi and his wife voted for the first time since being put under house arrest in 2011, an ally of Mousavi's told Reuters.

Iran, which has the world's second-largest gas reserves, a diversified manufacturing base and an educated workforce, is seen by global investors as a huge emerging market opportunity, in everything from cars to airplanes and railways to retail.

For ordinary Iranians, the prospect of this kind of investment holds out the promise of a return to economic growth, better living standards and more jobs in the long run.

An opening to the world of this scale -- and Rouhani's popularity -- have alarmed hardline allies of Khamenei, who fear losing control of the pace of change, as well as erosion of the lucrative economic interests they built up under sanctions.

Whatever the outcome, Iran's political system places considerable power in the hands of the conservative Islamic establishment including the 12-member Guardian Council, which vets all electoral candidates. It had already tried to shape Friday's vote by excluding thousands of candidates, including many moderates and almost all reformists.

(Additional reporting by Bozorgmehr Sharafedin, Babak Dehghanpisheh, Sam Wilkin; Editing by William Maclean, Catherine Evans and Paul Taylor)