Sunan Ibn Majah Book 35, Hadith 16
“If anyone of you sees a dream that he dislikes, let him
spit
dryly to his left three times and seek refuge with Allah from
Satan
three times, and turn over onto his other side.”
“Dreams are of three types: Some are terrifying things from Satan, aimed at causing grief to the son of Adam; some are things that a person is concerned with when he is awake, so he sees them in his dreams; and some are a part of the forty-six parts of prophecy.” He said: “I said to him: ‘Did you hear this from the Messenger of Allah (ﷺ)?’ He said: ‘Yes, I heard it from the Messenger of Allah (ﷺ), I heard it from the Messenger of Allah (ﷺ).’”
“(Good) dreams come from Allah and (bad) dreams come from Satan, so if anyone of you sees something that he dislikes, let him spit dryly to his left three times, and seek refuge with Allah from the accursed Satan three times, and turn over onto his other side.”