Everything MikeD wrote is true, but based upon my experience buying in Barcelona last year, while the process is well-defined, the level of compliance and professionalism is dependent upon the seller and their agents. In our situation, the seller’s agent was incompetent beyond belief, so much so that we had him re-write the contract and he actually made it worse.
Our deposit was submitted with the error-filled contract.
And what MikeD writes about renovations also echos my experience. I thought it would be completed by now but it probably will not begin until 2014. Silly me, in both cases (purchase and renovation) I thought the most difficult thing was raising the funds. That turned out to be the easiest part of the process.
Finally do get a mortgage outside of Spain if possible. As an American, I had to put more than 40% down for a not so good mortgage. I am held hostage to currency rates, exchange fees, etc. That said, it is mostly working in my favor for now.