The rental agreement could legally be a verbal agreement, but that is not safe...obviously.
So, in the most of the cases the rental contract is a simple document which explicits:
-Identity data of both landlord and tenant, addresses for notifications, marital status...
-Description of the property
-Renting time period
-Permanent/ as a home or temporary use of the house
-Others: Penalty clauses, guarantees agreed, rights to option to purchase...
There is no legal prescription of any particular format or sort of document: any kind of written document is valid. Even though if any of the parties wishes so, can legally request the other one to sign a written document.
There is an official form contract which is sold at any tobacconists in Spain.
The rental contract can also be done before a Notary Public (on a public deed) in order to have it registered in the Land Registry, this way your tenant/landlord position can be opposed against third parties. Not very frequent though.
The most common way is to write an ordinary private document on plain paper.
It is advisable to have a lawyer revising your rental contract, specially on the terms of possible extensions, guarantees for unpaid rents, submission to arbitration or Courts...
Best,
Maria L. de Castro
Generalife. Alhambra Palaces and Gardens