When a child is born is Spain, traditionally, she or he has one or two given names followed by two surnames. The second given name is many times chosen to honour some close friend or family member, typically, a grandfather or grandmother. The first surname is the father’s first surname, and the second is the mother’s first surname.
The first name usually indicates the gender of the child, but the second name can be feminine for a boy, or masculine for a girl. So, for example, a boy’s name could be José María (Joseph Mary) or a girl’s could be named María José. Many foreign friends have told me it was very shocking for them to know children called Jesús.
Some days after children are born, their parents have to go the Registro Civil (registry office). According to the Spanish legal system, a name cannot be insulting for the child and boys have to get masculine names and girls, feminine names. It can be difficult to register a foreign name because the civil servant does not know if the name is masculine or feminine.