More than 70 others were injured as the blast hit the San Pablito fireworks market in Tultepec, about 32km (20 miles) outside the city, the BBC reports.
Video from the scene showed a large number of fireworks rocketing into the air as they caught fire. People in neighboring towns reportedly could feel the ground tremble as fireworks stalls exploded.
Dozens of paramedics and police attended the scene. The cause of the explosions is not yet known.
Locals have been told to avoid the area and keep roads clear.
Eruviel Avila, governor of the State of Mexico, said some children had suffered burns to more than 90% of their bodies and they were being sent to the US city of Galveston, Texas, for specialised treatment.
Most of those killed are so badly burned their bodies will have to be identified using DNA testing, he added.
Fireworks continued to explode after the initial blast, as smoke billowed from the area in thick black clouds. The market had contained up to 300 tonnes of fireworks, Mexican media reported.
The president of Mexico, Enrique Pena Nieto, tweeted condolences to the families of the victims and wished a speedy recovery to the injured.
He also said members of the defence forces were assisting in the emergency.
The San Pablito market was heavily damaged by similar fires in September 2005, when a chain of explosions just before the country’s independence day celebrations injured dozens of people.