The 26-year-old entered two houses in Arak and shot eight people with a kalashnikov, killing five of them instantly, ISNA news agency quoted the city's prosecutor as saying.
A sixth victim later died in hospital and another was in critical condition, he added.
The first house targeted was the home of a police officer who had arrested the man last year on charges of complicity in a murder.
The officer, his sister, mother and brother were all killed while another family member was hospitalised.
Also Read
The shooter is still on the run but his brother, who allegedly accompanied him in the rampage, has been arrested, the prosecutor said.
The gunman had been released on bail of two billion rials (USD 50,000) on January 1.
Gun violence is rare in the Islamic republic and offenders face severe punishment.
Disclaimer: No Business Standard Journalist was involved in creation of this content