Like most things in a foreign country, it's not straightforward. There are numerous papers that need to be completed to register the car with the Spanish equivalent of the DVLA. There is also a tax to pay to register the car onto Spanish plates. This is a percentage based on what the Hacienda (government) values your car at. There is an import inspection to check the vehicle is suitable for registering in Spain along with an ITV test - the Spanish equivalent of an MOT test.
Finally, depending on which car you want to import, there will be some modifications required to adapt it for use in Spain, potentially including new Right-hand traffic headlamps and ensuring the vehicle has a fog lamp on the rear left side of the vehicle.