Rental agreements

I posted recently asking for advice on where to live. I could now do with some advice on rental agreements.

How do they work in Spain? We are looking at taking out a 12 month lease in October. What are our rights? Could a landlord kick us out in the middle of our lease to get the more lucarative holiday rentals in? Likewise, if we did not like the place we rented, how much notice do you have to give to move?

We are looking at moving to the Nerja/Almunecar area

Thanks in advance

Paul

(I apologise for posting twice in 2 different sections, I did not receive a response in the general chat forum)