To apply for a driving licence in Spain, you need to be a registered resident.
Licence AM (mopeds, micro cars) 15 years and not allowed to take passengers until age 18
Licence A1 (up to 125 cc) 16 years
Licence A2 (up to 35 kW) 18 years
Licence A 20 years as must have held licence A2 for 2 years before you can obtain it and not allowed to drive tricycles over 15kW until age 21
Licence B 18 years
Note: Provisional licences do not exist in Spain and provisional licences from other EU countries are therefore not valid to drive here.
Note II, with a Licence B you are allowed to drive mopeds and micro cars as well, and once you´ve held it for 3 years minimum, motor cycles up to 125 cc too.