Abdullah bin Umar reported,

The Prophet ﷺ saw mucus on the wall of the mosque while he was leading the people in prayer, so he scraped it off. When he finished, he said, "When one of you is in prayer, Allah is before his face, so let none of you spit in front of himself during the prayer."

Azami 2641

Sahih

عن ابن عمر قال

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

الأعظمي 2641صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
Minor actions do not invalidate the prayer
Section
Removing spit from the qiblah wall of the masjid during prayer
Numbering
Jami al-Kamil 2641 (2nd edition)
Azami 2641