I bought a place in Marbella last year. The process is very similar to what residents go through, but make sure you open a Spanish bank account early on. If you are also looking at other markets, you might find it interesting to compare regulations, for instance, by checking out this
guide to buying property in Thailand for foreigners to see how different the legal frameworks can be.