Iran's President Hassan Rouhani has won a second term in office, state television says.
Out of some 40 million votes cast, he received more than half of those counted, with some areas still to declare, officials said on TV.
Mr Rouhani, a moderate who agreed a deal with world powers to limit Iran's nuclear programme, would thus avoid a second-round run-off.
His main challenger has complained about alleged voting irregularities.
Ebrahim Raisi, a conservative cleric, accused supporters of Mr Rouhani of hundreds of acts of propaganda at voting booths, which are banned under electoral law.
Results from urban areas - much more likely to support Mr Rouhani - have not yet come in.
State TV congratulated Mr Rouhani on his victory. Near-complete results showed he had gained 58.6% of the vote, compared with Mr Raisi's 39.8%.
Voting time was extended by five hours on Friday, until midnight, amid an unexpectedly high turnout of about 70%.
Election officials said the extensions to voting hours were due to "requests" and the "enthusiastic participation of people".