Mohammed Bijeh, 23, confessed in court to raping and murdering the children, between March and September 2004. Iranian media have said Bijeh burned the bodies of his victims, all boys between 8 and 15.
Bijeh was sentenced to one death sentence for each murder he confessed and 100 lashes of the whip for the rapes.
An accomplice, Ali Gholampour, was acquitted of involvement in the murders but was convicted of taking part in some of the kidnappings, to which he confessed. He was sentenced to 15 years in prison and 100 lashes.
Bijeh's verdict was carried out in Pakdasht, a small, impoverished town about 19 miles southeast of Tehran, after being upheld by the Supreme Court. It was the same town where the murders took place.
Approximately 5,000 spectators — including women and children — gathered to watch the flogging and hanging. Riot police circled the area.
Some in the crowd threw stones at Bijeh as he was flogged, shirtless and hands tied to an iron pole. He fell to his knees three times as he received the lashes.
A relative of one of the victims broke police security and attacked Bijeh with a knife, wounding his back before police dragged him away.
After the flogging, a rope was put around Bijeh's neck and attached to a hook on a crane. The crane's arm jerked upward and Bijeh's body dangled, drawing applause from the crowd.
Some people burst into tears, crying out the names of their injured children. Some shouted, "Shame on you, Bijeh!"
After about 20 minutes, the body was lowered and a doctor confirmed Bijeh was dead.
Many in the crowd, some of them other family members of the victims, repeatedly tried to approach Bijeh's body but were prevented by riot police. Scuffles continued for at least half an hour.
The case provoked national outrage in Iran. Sixteen police officers were reprimanded for dereliction of duty and the Interior Ministry criticized the police for failing to catch the suspects after the first crime.
Many of the people in Pakdasht supported the hanging.
"Public executions reduce the occurrence of offenses. Bijeh destroyed many families. He deserved more than death," said resident Zahra Khaleghi.
But Dariush Mehraban said public hangings only promote violence.
"Many criminals have been hanged, but offenses have never reduced. It's an ugly scene that a human being is hanged even if he has committed many crimes. Revenge is not the solution," said Merhraban, who watched the hanging.
Convicts are hanged in public in Iran only if a court deems that their offenses deeply affected public sentiment.
Iranian courts are controlled by hard-liners. Iranian reformists say public executions hurt the country's international image and reflect badly on Islam.