If it is a standard rental contract, then both parties will have the option to terminate the contract, giving one month's notice.
Speaking as a landlord of Spanish property myself, this is what was in the contracts that our tenants signed.
We always sign the contract at our lawyers office, both parties are present and our lawyer explains the contract fully before allowing it to be signed.
You need to check through your contract as to what it states the landlord is required to give you in regards to notice.