Dozens of other people were injured as the blast hit the San Pablito fireworks market, about 20 miles (32km) outside the city.
Officials said a number of children were among those who were badly burned, on up to 90% of their bodies.
Fireworks continued to explode after the initial blast, as smoke billowed from the area in thick black clouds.