Agreed, you'll need a Residencia (Resident's Permit) which simply proves to the State that you can support yourself and won't be a burden to them. So, proof of income from a pension (for example) would be fine.
It's very easy to buy property in Spain - and therefore very easy to get "done" by cowboys. Take great care, and professional advice.
The most common problem is that property is either built without planning permission, or that the land on which it is built has not been designated for building. In either case, as the new owner, the problem of sorting it out would be yours.
Ensure there is an Escitura for the property - this is the equivalent of its title deeds and while not a guarantee of its legality, is a step in the right direction!
Also, be aware that any debts on the property (e.g. unpaid electricity bills) are transferred to the new owner, so you must check that everything is up date.
As has been said, there are many, many foreign residents living here, and, assuming you are American, you might like to contact the American Club of the Costa del Sol for more information relevant to your situation. Email me (firstname.lastname@example.org) if you want their address etc.
Hope this helps!