Several people, including an unspecified number of injured children from the Beixin Village Elementary School were rushed to hospital, and bodies were still being pulled out of the rubble.
The explosion occurred at 2 pm at the house of a mine operator in Kecheng, a town in Shanxi province, one of China's biggest coal-mining regions.
His house and the adjacent school were flattened by the explosion, and the students were buried in rubble, the local media said.
The mine manager, identified as Lu Maolin, was among the dead and his wife was injured.
While it is illegal to keep explosives at home, many Chinese mine operators continue to store large quantities at their residence.