In an authentic hadith, looking with desire to the opposite sex is called zina (fornication). This is an Arabic usage that allows naming the means by their consequences. So, as looking with desire may lead to committing fornication it was called zina in this sense. But it is not actual zina nor does it necessitate its punishment.

Likewise, masturbation is a sin but is not an actual zina. So, whoever does it should repent sincerely to Allah and to feel sorry for what he or she has done asking Allah to forgive and help him or her remain steadfast on His right path.