The conflagration, in the suburb of Tultepec, set off a quickfire series of multicolored blasts and a vast cloud of smoke that hung over Mexico City.
The market was packed at the time with customers buying pyrotechnics for traditional end-of-year festivities. Christmas and New Year’s parties in many Latin American countries very often wrap up with clattering firework blasts.
“We recovered 26 bodies at the scene of the incident,” Mexico state prosecutor Alejandro Gomez told reporters at the site.
Federal police, who had reported an initial death toll of nine, said on Twitter that 70 people were hurt and were being transported to emergency rooms.
Fire crews struggled for three hours before bringing the blaze under control.
The head of the civil protection service, Luis Felipe Puente, said they had to wait for all the fireworks explosions to stop. The damage was beyond vast.
“The entire market is gone,” he said.
He added that several of the injured were in “delicate condition,” and searches were under way for more casualties in the scorched area that looked like a scene from a post-apocalyptic film.
Homes and vehicles nearby were also damaged.
The military was deployed to help emergency crews transport casualties to hospitals by ambulance and helicopter.
Mexico’s President Enrique Pena Nieto tweeted his condolences to the families of those killed and his wishes for recovery for those hurt.
A local resident, Alejandra Pretel, told AFP: “The sound of blasts started to go off and we thought it was a nearby fireworks workshop.”
But minutes later it became evident that it was the market being destroyed.
“My neighbors said they felt everything shake, but I didn’t realize because I was running away,” she said.