While it is perfectly legal to arrange for the transfer of a property in Spain via a private legal contract, this is not the typical way of doing so.
From a practical point of view, no financial institution will offer a mortgage to facilitate the purchase without a public deed.
The process involves the drawing-up of the deeds of transfer by a public notary. A notary is an independent official who oversees the process and ensures that the proceedings take place according to the law and that the documentation is verified.
Below is a table with approximate costs according to house price. Please note these may vary and the cost must always be confirmed by the notary before proceeding: