The latest attack prompted the government to demand stricter school security.
Wang Yonglai used a motorcycle to break down the gate of Shangzhuang primary school in the eastern city of Weifang and struck a teacher before hitting pupils with the hammer.
Wang then grabbed two children before pouring petrol over his body and setting fire to himself. Teachers were able to pull the children away to safety, but Wang died. None of the five injured pupils had life-threatening injuries, it was reported.
The motive for Wang's rampage was unclear.
Most of the recent school attacks have been blamed on people with personal grudges or mental illness – seen as a growing problem because of feelings of social injustice and alienation in the fast-changing country.
The government's Beijing education commission ordered armed police units to patrol nursery, primary and secondary schools starting on Tuesday, the first day back to school after the May Day holiday. Police will be on site as classes begin and end.
The hammer attack follows a rampage on Thursday by a 47-year-old unemployed man armed with an 8in knife at a nursery. Twenty-nine pupils, aged four or five, were injured, five of them seriously, at the school in Taixing, in Jiangsu province.
And on Wednesday a 33-year-old former teacher broke into a primary school in the city of Leizhou in southern Guangdong and wounded 15 pupils and a teacher with a knife.
There have been five such attacks on schools in just over a month and many more in preceding months and years, usually by lone, male attackers.
The education ministry's directive yesterday called for schools and local education departments to "strengthen the security activities at schools to ensure the safety of pupils and teachers", particularly at kindergartens and primary schools.
It urged "concrete actions" including strictly implementing a rule already on the books to register all visitors coming to school campuses and stop unidentified people from entering.
The latest attacks have prompted schools across the country to take action.
In the southern city of Nanjing, guards will be armed with police batons and pepper spray. In Beijing's Xicheng district, guards at schools have been given long metal restraint poles with a hook on the end. And in eastern Jinan city, police posts are being built on primary school campuses.