If you have a car in Spain then you must have insurance. This is a legal obligation. If you have parked up the car in your underground parking because you are not using it you still have to maintain a car insurance policy. It doesn’t matter that you are not going to take it on the road or it is broken and unable to be driven.
At least a third party insurance is needed in case your vehicle causes damage to others. Although the car is in the garage there is still a possible risk of an electrical short circuit, for example. The Spanish law states that all owners of motor vehicles in Spain must have an insurance for each of those vehicles with at least the minimum obligatory cover required by the law.
A car without insurance could incur a penalty of between 600 and around 3,000 euros. It could also be that the authorities take the vehicle to a municipal compound if the position is not rectified within a few days.
The only time a vehicle in Spain is not obliged to have insurance is when it is registered officially with the traffic authorities as off the road either temporarily or permanently.