The blast in Arganda del Rey sent up a huge column of black smoke, but emergency services said several air quality measuring stations in the area showed normal readings, easing concerns about toxic pollution.
Thirty-seven people were injured in the blasts and fire at the plant, the Arganda del Rey city hall said in a statement.
Firefighters said three of the injured were in serious condition, two for burns and one with a fractured pelvis.
Madrid's emergency services centre said on Twitter there had been "several explosions" at the site about 30 kilometres (20 miles) southeast of the Spanish capital.
More From This Section
The authorities are investigating the cause of the blasts.
The Madrid regional government said people were evacuated from five schools and several workplaces in a radius of 500 metres (1,640 feet) around the plant as a precaution.
"Neighbours have been asked not to leave their homes and to keep windows closed," a spokesman for Arganda del Rey's city hall told AFP, emphasising however that air quality was "normal".
Requimsa, the company that owns the site, "manages and collects all types of hazardous waste", according to its website.