An historic Spanish city is at risk of severe flooding after weeks of torrential rain - one of several areas to declare a state of emergency.