It all depends on your circumstances:
1. When you have an EU driving licence, you can drive with it without any action.
2. You can exchange your licence if your country has a treaty with Spain.
3. If you do not have a driving licence, then you have to take all theory and practice tests. Having a driving licence from other countries (e.g. Russia, Kazakhstan, Belarus, Armenia, Georgia, Moldova, etc.) after 6 months of residency does not give you any privileges, i.e. you have to take all the exams in general.