Article 511 [source]

Spanish Criminal Code
English translation

1. Any private individual in charge of a public service who denies a person a benefit to which they are entitled on the grounds of their ideology, religion or beliefs, family status, ethnicity, race or nationality, national origin, sex, age, sexual orientation or gender identity, gender-based reasons, aporophobia or social exclusion, illness, or disability shall be subject to imprisonment for six months to two years, a fine of twelve to twenty-four months, and special disqualification from public employment or office for a period of one to three years.

2. The same penalties shall apply when the acts are committed against an association, foundation, society, or corporation or against its members on the grounds of their ideology, religion or beliefs, family status, ethnicity, race or nationality, national origin, sex, age, sexual orientation or gender identity, gender-based reasons, aporophobia or social exclusion, illness, or disability.

3. Public officials who commit any of the acts described in this article shall be subject to the same penalties, increased by half, and shall also be subject to special disqualification from public employment or office for a period of two to four years.

4. In all cases, the penalty of special disqualification from educational professions or occupations, in the teaching, sports, and leisure sectors, shall also be imposed for a period of one to three years longer than the term of imprisonment imposed. When the imposed penalty is a fine, the special disqualification shall last from one to three years. In all cases, the penalty shall be proportionate to the seriousness of the offense and the circumstances of the offender.