Images posted on social media showed cars being swept along narrow streets by torrents of brown water.
"My solidarity and support go out to the families and friends of victims and all those affected by these tragic floods," Prime Minister Pedro Sanchez said on Twitter.
Sanchez was planning to travel to the area later on Wednesday, his office said.
Lawmakers held a minute's silence before the weekly prime minister's question time on Wednesday morning.
(With inputs from agencies.)