Abu Hurairah reported,

The Messenger of Allah ﷺ saw some phlegm on the qiblah wall of the mosque. He turned to the people and said, "What is the matter with one of you who stands facing his Lord and then spits phlegm in front of Him? Would any of you like to be faced and have someone spit phlegm in his face? When one of you needs to spit phlegm, let him spit to his left under his foot. If he cannot, then let him do like this."Qasim demonstrated by spitting into his garment, then rubbing part of it against the other.

Azami 3126

Sahih

عن أبي هريرة

أن رسول الله ﷺ رأى نخامة في قبلة المسجد. فأقبل على الناس فقال: ما بال أحدكم يقوم مستقبل ربه فيتنخع أمامه؟ أيحب أحدكم أن يستقبل فيتنخع في وجهه؟ فإذا تنخع أحدكم فليتنخع عن يساره تحت قدمه. فإن لم يجد فليقل هكذا. ووصف القاسم، فتفل في ثوبه، ثم مسح بعضه على بعض.

الأعظمي 3126صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Mosques
Section
Prohibition of spitting in the masjid and towards the qibla
Numbering
Jami al-Kamil 3126 (2nd edition)
Azami 3126