Sahih al-Bukhari, Book 91, Hadith 23 (Bukhari 6746)

Narrated Abu Qatada Al-Ansari:

(a companion of the Prophet (ﷺ) and one of his cavalry men) "I heard Allah's Messenger (ﷺ) saying, "A good dream is from Allah, and a bad dream is from Satan; so, if anyone of you had a bad dream which he disliked, then he should spit on his left and seek refuge with Allah from it, for it will not harm him."