Sahih al-Bukhari, Hadith 6995 ⓘ
Narrated Abu Qatada: The Prophet said, "A good dream is from Allah, and a bad dream is from Satan. So whoever has seen (in a dream) something he dislikes, then he should spit without saliva, thrice on his left and seek refuge with Allah from Satan, for it will not harm him, and Satan cannot appear in my shape."
حَدَّثَنَا يَحْيَى بْنُ بُكَيْرٍ، حَدَّثَنَا اللَّيْثُ، عَنْ عُبَيْدِ اللَّهِ بْنِ أَبِي جَعْفَرٍ، أَخْبَرَنِي أَبُو سَلَمَةَ، عَنْ أَبِي قَتَادَةَ، قَالَ قَالَ النَّبِيُّ صلى الله عليه وسلم " الرُّؤْيَا الصَّالِحَةُ مِنَ اللَّهِ، وَالْحُلْمُ مِنَ الشَّيْطَانِ، فَمَنْ رَأَى شَيْئًا يَكْرَهُهُ فَلْيَنْفِثْ عَنْ شِمَالِهِ ثَلاَثًا، وَلْيَتَعَوَّذْ مِنَ الشَّيْطَانِ، فَإِنَّهَا لاَ تَضُرُّهُ، وَإِنَّ الشَّيْطَانَ لاَ يَتَرَاءَى بِي " .
also referenced under: Book 91, Hadith 14 (In-Book) & Volume 9, Book 87, Hadith 124 (USC-MSA)