This free space discusses Spanish surnames in detail: https://www.wikitree.com/wiki/Space:Spanish_Naming_conventions
The basic approach, extracted from the link above is as follows:
“ When supported by records or sources, BOTH surnames (family names) should be put into the “Last Name at Birth” box.
Sometimes Spanish surnames (family names) are connected by “y” (and), thus joining them and effectively making them one name.
In addition, some names have more than one part, having a descriptor which takes the form “of the…”. Example: Gomez de la Torre (of the Tower). This is an accepted form, and "de", "del", or "de la" should only be removed if the profile is part of the European Aristocrats project which requires removing this portion of the name.
It is therefore suggested that, on Wikitree, ALL parts of both surnames should appear in the “Last Name at Birth” box. (The name could be quite long!)”