Majidreza Rahnavard was sentenced to death by a court in the city of Mashhad for killing two members of the security forces with a knife, the judiciary's Mizan Online news agency reported.
Iran has executed a second prisoner detained and convicted amid nationwide protests that have shaken the regime for almost three months.
State television on Monday aired footage, claiming it showed the man identified as Majidreza Rahnavard stabbing two security force members to death and running away.
Iran's Mizan news agency, under the country's judiciary, alleged Rahnavard had stabbed two security force members to death on November 17 in the city of Mashhad and wounded four others.
The agency said the execution took place on Monday morning, in public, in Mashhad.
Footage aired on state TV showed a man chasing another around a street corner, then standing over him and stabbing him after he fell against a parked motorbike.
Another showed the same man stabbing another immediately after. The assailant, which state TV alleged was Rahnavard, then fled.
READ MORE: Iran summons British, German envoys for 'meddling' in internal affairs
Crackdown on protesters
The Mizan report identified the dead as "student" Basij, paramilitary volunteers under Iran's Revolutionary Guard. The Basij (ba-SEEJ’) have deployed in major cities, attacking and detaining protesters, who in many cases have fought back.
A heavily edited state television report aired after Rahnavard's execution showed clips of him in the courtroom. In the video, he says he came to hate the Basijis after seeing video clips on social media of the forces beating and killing protesters.
The Mizan report accused Rahnavard of trying to flee to a foreign country when he was arrested.
The public hanging of Rahnavard, less than a month after he allegedly carried out the fatal stabbings — purportedly angry about security forces killing protesters — shows the speed at which Iran now carries out death sentences handed down for those detained in the demonstrations the government hopes to put down.
Activists warn that at least a dozen people already have been sentenced to death in closed-door hearings.
At least 488 people have been killed since the demonstrations began in mid-September, according to Human Rights Activists in Iran, a group that's been monitoring the protests. Another 18,200 people have been detained by authorities.
Mashhad, a Shia holy city, is located some 740 kilometres (460 miles) east of the Iranian capital, Tehran.
Activists say it has seen strikes, shops closed and demonstrations amid the unrest that began over the Sept. 1 6 death in custody of Mahsa Amini, a 22-year-old woman who had been detained by Iran's morality police.
Mizan said Rahnavard was convicted in Mashhad's Revolutionary Court.
The tribunals have been internationally criticised for not allowing those on trial to pick their own lawyers or even see the evidence against them.
Iran is one of the world’s top executioners and typically executes prisoners by hanging. It executed the first prisoner detained during demonstrations last Thursday.
READ MORE: Iran executes protester convicted of injuring security guard