Yes, if you are from one of the countries that form the European Union, and for residents from several other countries as well, if there is an agreement in place between their country and Spain.
EU citizens – must be registered on padrón, if you recently moved, best to make sure your correct data are on the census. You have until the 30th of December this year to be included on the list of persons with right to vote.
Norway – agreement in place, must have been registered on padrón without interruption for at least 3 years.
Bolivia, Cabo Verde, Colombia, Corea, Chile, Ecuador, Iceland, Paraguay, Perú, Trinidad y Tobago and New Zealand – agreement in place, must have been registered on padrón for at least 5 years.
Those residents from the ´agreement-countries´-as their right to vote is established seperately for each municipal election- should receive a notification by ordinary mail, to check their data as they are known on the census and to indicate if they wish to exercise their right to vote, so they can be included (or not) in the definite ´Electoral Roll´. You can return the notification by ordinary mail to get your data updated.
You can also check your data, if you have voted before and if you have a digital certificate installed on your computer.
You need to log in to the website of the National Statistics Institute, link and info in English provided here.
https://sede.ine.gob.es/ss/Satellite?