The uncontrolled fire, in the Mexico City suburb of Tultepec, triggered a quick-fire series of multicolored blasts and a sent a vast cloud of smoke surging over the capital city.
The market had been packed with customers buying pyrotechnics for traditional end-of-year festivities. Christmas and New Year´s parties in many Latin American countries often wrap up with clattering firework blasts.
From a few kilometers (miles) away, the multiple explosions that started at 2:50 pm (2050 GMT) almost looked festive, alight in blue, red and white. They were anything but.
Mexico state´s governor Eruviel Avila said, "We recovered 26 bodies at the scene of the incident. And three more have died in the hospital, for a total of 29 dead."
Federal police said that 70 people were hurt and were transferred to hospital for medical treatment.
Fire crews struggled for three hours before bringing the blaze under control.
The head of the civil protection service, Luis Felipe Puente, said crews had to wait for all the fireworks to finish exploding before they could extinguish the flames.
He added that several of the injured were in "critical condition," and searches were under way for more casualties in the scorched area that looked like a scene from a post-apocalyptic film, with little left standing in the smoldering ruins.
Homes and vehicles nearby were also severely damaged. In some areas, authorities were gently probing for survivors under heaps of charred and twisted roofing material.
People desperately searching for family and friends shouted and gestured to rescuers about where they hoped their missing loved one might be found.
Most of those being picked up by rescuers had severe burns, many over their entire bodies.
The military, which is in charge of issuing fireworks sales permits, was deployed to help emergency crews transport casualties to hospitals by ambulance and helicopter.
Ambulances, fire trucks, police vehicles and army trucks all crowded the sprawling blast area.
Mexico´s President Enrique Pena Nieto tweeted his condolences to the families of those killed and his wishes for recovery for those hurt.
The cause of the blast was under investigation. Some speculated it could have been mishandling of gunpowder or other fireworks components.