Under the 2015 EU regulations you are able to choose whether the laws applicable to your estate are those in your last habitual residence or your home country.
So, if you are resident in Spain, then Spanish Law will be applied unless you have specifically stated in your will that you wish the law of your home country to be applied.