The attacker, Zheng Minsheng, 41, worked as a doctor in a community clinic before resigning last June, Xinhua said, citing Huang Zhongping, spokesman for the Nanping city public security bureau.
Zheng was known to have a history of mental illness, said a man surnamed Wu in the Nanping city government office, who would not give his full name as is common among Chinese officials.
Eight children from Nanping City Experimental Elementary School were killed, and five were being treated at a hospital, Wu said. Six died at the scene.
The victims' ages were not known, but Chinese elementary schools typically have students ages 6 to 12.
The school, located in Fujian province, was closed and students were sent home for the day. Counseling would be provided for students when classes resume Wednesday, Xinhua said.
China has witnessed a series of school attacks over the past several years, which are often blamed on personal grudges or people with psychiatric problems, leading to calls for improved security.