The blast, which occurred in a building on Toledo Street, caused extensive damage, according to a video footage released by the Emergency Information Service in Madrid City Hall, Emergencias Madrid.
The service said that at least four floors were affected by the blast and that firefighters were evacuating people from the area. The mayor added that the building may be at risk of collapse.
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.
“Many people are being treated (with injuries) of varying severity,” Madrid Mayor Jose Luis Martinez Almeida told reporters.
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.
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.