What do you mean "the legal surname"? I'm Spanish and my legal name is my full name with both family names. You can't just ignore one. Also, Spanish people have two family names, but they can be composite, so they may look as three or four family names.
However, most people are usually known by one family name, but which one is used depends on which one is more easily recognizable.
However, most people are usually known by one family name, but which one is used depends on which one is more easily recognizable.