'Last Names' Come From Both the Mother and the Father.
Traditionally, if John Smith and Nancy Jones, who live in an English-speaking country, get married and have a child, he or she would end up with a name such as Chris Smith.
However, it's not the same in most places where Spanish is spoken as the native language. If Juan López Marcos marries María Covas Callas, their child would end up with a name such as Mario López Covas.
Spanish surnames might seem confusing at first, but that's mostly because they are passed on differently from English-speaking countries. Although there are numerous variations of how names are handled, just as there can be in English, the basic rule of Spanish names is fairly simple: In general, a person born into a Spanish-speaking family is given a first name followed by two surnames. The first surname being the father's family name (or, more precisely, the surname he gained from his father) followed by the mother's family name (or, again more precisely, the surname she gained from her father).
Take as an for example the name of Teresa García Ramírez. Teresa is the name given at birth, García is the family name from her father, and Ramírez is the family name from her mother.
If Teresa García Ramírez marries Fernando Arroyo López, she doesn't change her name. But it would be extremely common for her to add "de Arroyo" (literally, "of Arroyo"), making her name Teresa García Ramírez de Arroyo.
Sometimes, the two surnames can be separated by y (meaning "and"), although this is less common than it used to be: Fernando Arroyo y López.
Sometimes you will see names that are even longer. Although it isn't done often, at least formally, it is possible also to include grandparents' names in the mix.
Things can get a bit complicated for Spanish-speaking people living in places such as the United States, where it is not the norm to use two family names. One choice many make is for all family members to use the father's paternal family name. Also quite common is to hyphenate the two names, e.g., Fernando Arroyo-López and Teresa García-Ramírez. Couples who have been in the United States a long time, particularly if they speak English, are more likely to give their children the father's name, following the dominant U.S. pattern. But practices do vary.
The practice of a person being given two family names became the custom in Spain largely because of Arabic influence. The custom spread to the Americas during the years of conquest.
To learn more about the culture, we recommend that you do a Spanish immersion. In addition, staying with a Spanish host family will allow you to practice what you learnt during your morning Spanish classes.