The crowd overpowered security services and helped two men convicted of robbery to escape hanging in the province of Kerman, the Fars news agency reported.
The men were recaptured hours later, and justice department officials say they will be put to death on Wednesday.
Iran executes more people than anywhere else in the world except China, human rights groups say.
The members of the crowd who aided their escape will also be punished, officials said.
This year the Iranian government has increased the already high number of executions, possibly as a way of asserting its authority in the wake of the disputed presidential election result, BBC correspondents say.
Human rights groups accuse Iran of making excessive use of the death penalty but Tehran insists it is an effective deterrent that is used only after a lengthy judicial process.