The wealth tax in Spain is mandatory when you meet a number of conditions. However, these are different if you are a resident in Spain or not and there is generally (with a few exceptions) a tax-free allowance of €700,000. In other words, most people only need to file wealth tax in Spain when their wealth in Spain exceeds €700,000.
The exception to this is when your assets amount to more than €2,000,000 prior to the deduction of debts. Then this declaration must also be submitted, but you will not have to pay anything, if the net result is below the €700,000 as there is no tax due in this case.