Unlicenced drivers and most non-EU citizens are required to take a Spanish driving test, (written theory and practical), in order to obtain a Spanish driving licence. Helpfully, in larger cities and places where a large part of the population is not from Spain, the driving test can be conducted in your native language.
There are many driving schools advertised in foreign language newspapers and magazines offering preparation for the Spanish test. If the test is not available in your native language, you will have to take it in Spanish, and this can be tough even if Spanish is your native language. The testing process is difficult (even for Spaniards) and expensive so make sure you are prepared to dedicate yourself to studying and practicing during the course.
You have three attempts to pass (this includes both the written and actual driving test) and then you have to pay additional fees for another three chances to pass. The theory test consists of 40 (trick) questions, of which you can fail three. This can be a frustrating experience for drivers who have already held a driving license in their own country and been driving for many years.