Mishkat al-Masabih 4612
Abu Qatada reported God’s messenger as saying:
"A good vision comes from God and a dream ( hulm ) from the devil. So when one of you sees what he likes he must tell it only to one whom he likes; but when he sees What he dislikes he must seek refuge in God from its evil and from the evil of the devil, spit on his left three times, and not tell anyone of it. It will then not harm him.” 

(Bukhari and Muslim.)
وَعَنْ أَبِي قَتَادَةَ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «الرُّؤْيَا الصَّالِحَةُ مِنَ اللَّهِ وَالْحُلْمُ مِنَ الشَّيْطَانِ فَإِذَا رَأَى أَحَدُكُمْ مَا يُحِبُّ فَلَا يُحَدِّثُ بِهِ إِلَّا مَنْ يُحِبُّ وَإِذَا رَأَى مَا يَكْرَهُ فَلْيَتَعَوَّذْ بِاللَّهِ مِنْ شَرِّهَا وَمِنْ شَرِّ الشَّيْطَانِ وَلْيَتْفُلْ ثَلَاثًا وَلَا يُحَدِّثْ بِهَا أحدا فَإِنَّهَا لن تضره»