Seven girls and two boys were killed in the rampage on Friday, Xinhua news agency said, citing local police.
The suspect, 28, has been detained and the injured children were receiving treatment, the Mizhi county government in Shaanxi province said on its official social media account.
The attack – one of the deadliest rampages in the country in recent years – took place at 6:10pm local time (10:10 GMT), it said.
The suspect had been a student at the same school, where he had been bullied, the Washington Post reported, quoting the Mizhi county government.
In spite of China’s strict gun-control laws, there have been a number of attacks that targeted schoolchildren in the recent past.
In January 2017, a man armed with a kitchen knife stabbed and wounded 11 children at a kindergarten in China’s southern Guangxi Zhuang autonomous region.
In February 2016, a knife-wielding assailant wounded 10 children in Haikou, in the southern island province of Hainan, before committing suicide.
In June last year, a bomb blast that killed eight people and injured dozens outside a kindergarten in Fengxian, eastern China, was blamed on a 22-year-old introvert with health problems who had written the words “death” and “destroy” on the walls of his apartment.
Sociologists blame this rise in attacks on mental health disorders resulting from increased stress among the population as the pace of life becomes faster.
An acute lack of psychological support mechanisms in the country compound the issue.