You see this in Spanish a lot too. Diaz is son of Diego, which is still a common enough name. But there seem to be many more examples where the corresponding name is now rather uncommon from what I can tell. I am thinking of examples such as Menendez, Ortiz, Juarez, and Ordonez.
Both my endodontist and dentist have names ending in -ez, so I looked it up.
I wonder if this is a common pattern across all cultures and languages - if surnames share some sort of phonetic pattern, does it almost always indicate a patronymic, or (whatever the term for your profession/place of origin) is?