Abu Qatadah, may Allah be pleased with him, reported:
I heard Allah's Messenger (may peace be upon him) as saying: A good vision (dream) comes from Allah and a (bad) dream (hulm) is from the 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. Hadith number 4195 in Sahih Muslim