Sunan Ibn Majah, Book 35, Hadith 18 (In-Book)

It was narrated from Abu Hurairah that the Messenger of Allah said: “If anyone of you sees a dream that he dislikes, let him turn over and spit dryly to his left three times, and ask Allah for its good and seek refuge from its evil.”

حَدَّثَنَا عَلِيُّ بْنُ مُحَمَّدٍ، حَدَّثَنَا وَكِيعٌ، عَنِ الْعُمَرِيِّ، عَنْ سَعِيدٍ الْمَقْبُرِيِّ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ ‏ "‏ إِذَا رَأَى أَحَدُكُمْ رُؤْيَا يَكْرَهُهَا فَلْيَتَحَوَّلْ وَلْيَتْفِلْ عَنْ يَسَارِهِ ثَلاَثًا وَلْيَسْأَلِ اللَّهَ مِنْ خَيْرِهَا وَلْيَتَعَوَّذْ بِاللَّهِ مِنْ شَرِّهَا ‏" ‏ ‏.‏

sunnah.com