Abdullah bin Umar reported,

The Messenger of Allah ﷺ saw some phlegm on the qiblah wall of the mosque while he was leading the people in prayer, so he scraped it off. When he had finished the prayer, he said, "When one of you is in prayer, Allah is before his face, so let none of you spit toward his face during prayer."

Ibn Majah 763

Sahih

حدثنا محمد بن رمح المصري أنبأنا الليث بن سعد عن نافع

عن عبد الله بن عمر قال

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

ابن ماجه 763صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Mosques and congregations
Chapter
Disliking phlegm in the masjid
Numbering
Darussalam 763
Ibn Majah 763