look at this link and should tell what you need to do
http://www.spainexpat.com/spain/information/buying_and_selling_a_second_hand_car_in_spain/
paper work would be * Permiso De Circulaci?n - In England you would call this the Log Book. It gives the car details, number plate, chassis number, make and model, year of first registration, and most importantly the name and address of the current owner.
* Inspecci?n T?cnica - Also called the ITV. In England you would call this the MOT. It gives the car details, and is stamped and dated with the last ITV inspection passed and stating for how many years (1 or 2) this is valid.
* Impuesto Sobre Vehiculos - This is equivalent to a road licence fee. It is payable yearly to the Ayuntamiento where the owner is registered.