Rowhani, a former top nuclear negotiator, won 16.4 million of the 32.1 million votes counted by 7 pm (1430 GMT), the ministry said.
If repeated at the remaining polling stations, his 50.99 percent tally would be enough to give him outright victory without recourse to a second-round run-off.
Tehran Mayor Mohammad Baqer Qalibaf was in distant second place with 5.07 million votes or 15.76 per cent.
He was followed by Saeed Jalili, Iran's current top nuclear negotiator, with 11.38 percent and former Revolutionary Guards commander Mohsen Rezai with 11.16 percent.
More than 50.5 million Iranians were eligible to vote to elect a successor to Mahmoud Ahmadinejad, who was constitutionally barred from standing again after serving two consecutive terms.
