Taking another nationality is the commonest cause. Another is automatic: someone born abroad to a Spanish parent also born abroad loses it unless they declared, within three years of turning 18, that they wished to keep it.