Hmm...not sure if you would be able to if you are not resident in the country.
You could also have problems if yo uwant to drive at home.
I know that if you hold a spanish licence and want to drive in the UK you have to take the UK driving test within 12 months.
Also, my friend is taking his test in Barcelona, having previously had lessons in the Uk, and he told me that he thinks its much tougher there - the level of theoretical knowledge required is much greater.