In the distant past, most people lived in small villages and knew each other by name. No one really needed more than one name. But as the villages grew larger, there might be two or three people with the same name, and so an identifier was added. Bill the carpenter was distinguished from Bill the fisherman or Bill the miller. These were all trades. Later, 'the' was dropped and they became Bill Carpenter, Bill Fisher, or Bill Miller. Other identifiers might tell where they came from. Bill from Scotland might be called Bill Scott. Or Bill with Black hair might be known as Bill Black.
I can not give you the origins of the Spanish names you have cited, but I would suspect it was something similar and the names related to a place, a physical description, or a craft.
I have a friend who carries the surname Ruedo....