The blast, which occurred in a building on Toledo Street, caused widespread damage, according to a video clip released by the City Hall Emergency Information Service, Emergencias Madrid.
Pictures from the scene showed that part of the exterior wall had been torn off several floors of the building, making the rooms exposed. Debris covered the parked vehicles and the street below, and a deformed metal street sign can be seen.
The service said that at least four floors were affected by the blast and that firefighters were evacuating people from the area.
Mayor Jose Luis Martinez Almeida told reporters that the building may be subject to collapse. «Many people are being treated (for injuries) of varying severity,» he said.
A spokesperson for the emergency services told CNN that the dead were an 85-year-old woman and a man whose age was not immediately known. He said that two of the injured were taken to hospital, one of them suffered from a broken ankle.
The spokesman added that there were no casualties among the elderly living in a nursing home adjacent to the building where the explosion occurred or in a nearby school.
Martinez urged Almeida to exercise caution as the authorities were still getting more details after the explosion. «It appears that there has been a gas explosion,» he said.
The Diocese of Madrid said that the building belonged to the neighboring Church of the Assumption of La Paloma and San Pedro Real, and that it was «completely destroyed».
«Two priests are in good condition and one of them has been taken to a hospital. We are trying to find a person who was with them when the explosion occurred,» the diocese said in a statement.
A spokesman for the Spanish National Police told CNN that police officers are at the site.
Antonio Perlanga, Los Nogales accommodation manager, said all residents have been evacuated from the nursing home.