Seven children were injured after a man went on a stabbing spree inside a primary school on Savu, a small island in East Nusa Tenggara province.
The 32-year-old attacker tried to flee but was caught and taken to a police station, said local officer Silfeston, who like many Indonesians goes by just one name.
But once there hundreds of locals, furious at news of the attack, rushed to the station, forcing their way past police and into the cell where theman was being held.
"The suspect was tortured by the mob and died," Silfeston said.
Footage aired on local broadcasters showed dozens of shouting men pushing past police and climbing over walls at the station.
The injured children, aged eight to 11, were taken to hospital for treatment, Silfeston said.
Police are still investigating the mob killing and the motivation behind the knife attack.
Savu is home to around 100,000 people.