Spain is a UN member and signed the "The United Nations Universal Declaration of Human Rights article 15 states that everyone has the right to a nationality and that no one should be arbitrarily deprived of a nationality or denied the right to change nationality."  This is a higher law than Spain's Constitution.