Several roads in the Madrid region were closed as half a dozen bridges were torn down by water overflowing the riverbanks.
The sudden torrential rain that hit the country transformed streets into rivers in Madrid, Castile, Catalonia and Valencia regions. Hail also fell in many areas.
The heavy rainfall was waning on Monday morning, though.
Rain continued in most of the country, but the National Weather Agency on Monday lowered the alert level to yellow from orange and red on Sunday.
Several subway lines were closed in the centre of Madrid on Monday morning. Some high-speed connections between Madrid and the Andalusia region, in southern Spain, resumed later on Monday, but trains were operating at lower-than-normal speeds.