https://en.wikipedia.org/wiki/Surname
https://es.wikipedia.org/wiki/Apellido#Origen_de_los_apellid...
A bit of googling gives me the explanation of "ferreira" being an old word for "iron mine", which to be honest is coherent with modern portuguese forms like "pedreira", toponymics ("ferreira" is a common place name), and the way names come about (João da Ferreira would own or work in the iron mine, or just come from one of the villages where there was an iron mine).
BTW, the theory I've heard is that this surname prevails due to survivorship bias, in countries that were constantly at war and the male population was being decimated, the smiths had to stay back home manufacturing weapons (same logic applies for "miller" and "tailor" and "mayor", all very common last names in large parts of Europe).