Even if you are a non-resident in Spain, you may need to deal with the Spanish Tax Authorities (AEAT). To do so, you may go personally to your nearest AEAT’s office or you may proceed on internet.
To work on internet with the AEAT you need the Digital Signature, or – if you are a resident in Spain – you can work with the PIN24.
My personal advice is to obtain the Digital Signature, as it is for a period of several years (three years), can be used anywhere and works also with other Spanish Administrations (as Social Security). The Digital Signature can be exported and saved in a USB, so you can deploy it in any computer (but if it is not your computer, always remember to delete it as soon as you have finished).
The PIN24 hours has a limited period of validity (24 hours), so you will need to get another one every time you need to deal with the AEAT.