كتاب الرؤيا
42
The Book of Dreams

Abu Salama reported:

I used to see dreams (and was so much perturbed) that I began to quiver and have temperature, but did not cover myself with a mantle. I met Abu Qatada and made a mention of that to him. He said: I heard Allah's Messenger (ﷺ) as saying: A good vision comes from Allah and a (bad) dream (hulm) from devil. So when one of you sees a bad dream (hulm) which he does not like, he should spit on his left side thrice and seek refuge with Allah from its evil; then it will not harm him.
حَدَّثَنَا عَمْرٌو النَّاقِدُ، وَإِسْحَاقُ بْنُ إِبْرَاهِيمَ، وَابْنُ أَبِي عُمَرَ، جَمِيعًا عَنِ ابْنِ عُيَيْنَةَ، - وَاللَّفْظُ لاِبْنِ أَبِي عُمَرَ - حَدَّثَنَا سُفْيَانُ، عَنِ الزُّهْرِيِّ، عَنْ أَبِي سَلَمَةَ، قَالَ كُنْتُ أَرَى الرُّؤْيَا أُعْرَى مِنْهَا غَيْرَ أَنِّي لاَ أُزَمَّلُ حَتَّى لَقِيتُ أَبَا قَتَادَةَ فَذَكَرْتُ ذَلِكَ لَهُ فَقَالَ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ ‏ "‏ الرُّؤْيَا مِنَ اللَّهِ وَالْحُلْمُ مِنَ الشَّيْطَانِ فَإِذَا حَلَمَ أَحَدُكُمْ حُلْمًا يَكْرَهُهُ فَلْيَنْفُثْ عَنْ يَسَارِهِ ثَلاَثًا وَلْيَتَعَوَّذْ بِاللَّهِ مِنْ شَرِّهَا فَإِنَّهَا لَنْ تَضُرَّهُ ‏"‏ ‏.‏
Reference : Sahih Muslim 2261 a
In-book reference : Book 42, Hadith 1
USC-MSA web (English) reference : Book 29, Hadith 5613
  (deprecated numbering scheme)