قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ : " عَلَى ابْنِ آدَمَ نَصِيبٌ مِنَ الزِّنَا أَدْرَكَ ذَلِكَ لا مَحَالَةَ، قَالَ : فَالْعَيْنُ زِنْيَتُهَا النَّظَرُ وَتَصْدِيقُهَا الإِعْرَاضُ، وَاللِّسَانُ زِنْيَتُهُ الْمَنْطِقُ، وَالْقَلْبُ زِنْيَتُهُ التَّمَنِّي، وَالْفَرْجُ يُصَدِّقُ بِمَا ثَمَّ أَوْ يُكَذِّبُ "
And the Messenger of Allah, peace and blessings be upon him, said: "A portion of adultery has been decreed for the son of Adam, which he will inevitably encounter. The adultery of the eye is looking (at what is forbidden), and its confirmation is averting the gaze (if a person turns away after the first glance and lowers his eyes upon seeing what is forbidden, then this is a true gaze, otherwise not). The adultery of the tongue is speaking (obscenely), the adultery of the heart is wishing and desiring, and the private parts either confirm or deny (the act of) sin."
Related hadith on this topic