In this case, quite a lot. The tradition in Spain is for a child to take on the surname of their father and mother, hence why most Spanish people always have two surnames. Unlike in the English tradition where a double-barrelled name might be a sign of social status and be related to questions of inheritance, the Spanish tradition has no such significance.
Where things can be confusing for those who are not used to this system is in the case of weddings and births, in other words, in cases where two double-barrelled surnames need to be merged to produce just one double-barrelled surname. Obviously, some of the surnames will need to be left out (or Spanish names would be pages long by now) and the way this is done has been dictated by social convention for centuries. Traditionally, and unsurprisingly perhaps given Europe’s patriarchal history, the surnames which survive the transformation process and get the first position have been the ones inherited from male relations (fathers, husbands, etc.).
When a child is born, its surname is typically composed of both the mother and the father’s surnames, but only one part of each, the ‘male’ part. Remember that both parents’ double-barrelled surnames are made up of their respective father and mother’s names. For example, according to tradition, Anna Martínez García will have inherited the name Martínez from her father (which was, in turn, his father’s name), and the name García from her mother (which was her own father’s name). So even though the child inherits part of its surname from both its mother and father, it is always the part of that parent’s name that was given to the parent through their father which is transmitted.
And the ordering of these names is not something that has been left to the parents to decide. Until 1999 the law stated that it was the father’s name which would come first in the ordering of the child’s surnames. Let’s imagine that Anna Martínez García and her partner Luis Sanchez Pérez have a daughter called Alexia. According to tradition, her full name would be Alexia Sanchez Martínez. However since 1999 a new law was introduced which states that the order of the child’s surnames can now be decided by the parents, although social convention means that many continue to list the father’s name first. And since 2011, an additional law states that each child can choose the order of their names upon turning 18 years old.
Where Spain perhaps breaks with the tradition is in terms of the convention surrounding name changes in the cases of marriage. In many European countries, the convention is for women to take on their husband’s name when they marry, but this has never traditionally been the case in Spain. On the occasion that it has happened, the name change usually involves the woman adding her spouse’s name to the end of her own, usually preceded by the prefix ‘de‘. More often than not this arises in cases where the inclusion of the man’s name indicates a certain social status or nobility, similar in this instance to the custom in English-speaking countries.
Although most Spanish people have two surnames, the custom is for them to only be referred by one of them when being addressed in everyday life. This is usually the first of the two surnames as they appear in writing, meaning that Anna Martínez García would usually be referred to as señora Martínez, and her partner Luis Sanchez Pérez would be referred to as señor Sanchez. This custom and the fact that most Spanish people have two surnames can sometimes lead to confusion in situations where people or companies that are not used to this system attempt to alphabetize names. The mistake made most frequently is to assume that the name that appears at the very end of the full name is the surname and to refer to that person by that name alone. In our example from above, Anna would be used to someone referring to her as Sra. Martínez García or Sra. Martínez, but not just Sra. García.
So there we have it, what can seem complicated at first glance actually makes perfect sense when you understand the logic behind it. Next time you meet your Spanish work colleague, friend or neighbour you can feel a little more tranquillo about getting their name right.