Morteza Amini Moqaddam was pardoned by the father of Hadi Mohebbi, the man he fatally stabbed in mid-December.
A dozen members of Moqaddam's family had surrounded Mr Mohebbi's father, brandishing open copies of the Koran, the Muslim holy book.
"Islam demands forgiveness. Forgive him for the sake of the Koran," they chanted.
'Please help us'
As the rope was fixed around Moqaddam's neck he started weeping and his relatives turned to the crowd, pleading, "Please help us," and, "he's only 17 years old. Please ask for forgiveness with us."
Many people joined in with the pleas for mercy but some demanded the sentence should be carried out. "He should be killed," they shouted. "Otherwise he will kill again."
With Mr Mohebbi's father's decision to forgive the teenager the crowd raised him on their shoulders and shouted "God is great" and "Long live Mohebbi".
Moqaddam was immediately returned to prison in the ambulance that had been waiting to take his body away. Judicial authorities will now decide what jail sentence he must serve.
Militia member
The dead man Hadi Mohebbi, a member of the Iran's 5-million strong, hard-line Basiji volunteer militia, was allegedly unpopular because of his religious fervour and his accusations that local youths were harassing young women.
He was reportedly attacked by a gang of eight youths in southeast Tehran and stabbed to death.
Moqaddam's accomplice, Hamed Nazemi, was sentenced to 15 years in prison and 74 lashes.
The Basiji militia are under the direct command of Iran's Supreme Leader Ayatollah Ali Khamenei and were involved in ending pro-democracy riots that erupted in Tehran July before spreading to several other Iranian cities.