It is not Spanish but Italian, but thanks to immigration it has a place in the lunfardo, where cazzo (catzo) brought the same meaning of "damn, penis", especially in an exclamation. There is no agreed etymology, although it is possibly a variation of the Lombard cazz ("ladle") which already had a profane meaning in some verses and expressions.
* Only one "like" per meaning and day, the more "likes" the meaning will appear higher in the list