As a citizen from another EU country you are permitted to stay in Spain for up to 182 days in a calendar year. No special permit is needed.
If you plan to stay in Spain for an extended period you will have to apply for "Residencia".
The "Residencia" is a permit to live in Spain indefinitely, and will be granted only if you can show that you have monetary funds to support yourself. In addition you will either need a private health insurance or form E121.
The Spanish government has passed a royal proposition that will permit certain citizens of any EU-country to stay in Spain indefinitely without applying for a residencia. In future students and aliens (and their families) working in Spain will no longer require a residencia.
However - retired people will still need to apply for the residencia.