Sunan Abi Dawud, Hadith 5003 ⓘ
Abu Qatadah said: I heard the Messenger of Allah (May peace be upon him) say: A good vision comes from Allah and a dream (hulm) from the devil, so when one of you sees what he dislikes, he must spit on his left (three times), and seek refuge in Allah from its evil. It will then not harm him.
حَدَّثَنَا النُّفَيْلِيُّ، قَالَ سَمِعْتُ زُهَيْرًا، يَقُولُ سَمِعْتُ يَحْيَى بْنَ سَعِيدٍ، يَقُولُ سَمِعْتُ أَبَا سَلَمَةَ، يَقُولُ سَمِعْتُ أَبَا قَتَادَةَ، يَقُولُ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ " الرُّؤْيَا مِنَ اللَّهِ وَالْحُلْمُ مِنَ الشَّيْطَانِ فَإِذَا رَأَى أَحَدُكُمْ شَيْئًا يَكْرَهُهُ فَلْيَنْفُثْ عَنْ يَسَارِهِ ثَلاَثَ مَرَّاتٍ ثُمَّ لْيَتَعَوَّذْ مِنْ شَرِّهَا فَإِنَّهَا لاَ تَضُرُّهُ " .
also referenced under: Hadith 5021 (DarusSalam)