From Sahih Bukhari (Hadith 406):
Narrated `Abdullah bin `Umar:Allah's Messenger (ﷺ) saw sputum on the wall of the mosque in the direction of the Qibla and scraped it off. He faced the people and said, "Whenever any one of you is praying, he should not spit in front of him because in the prayer Allah is in front of him
Reference: Bukhari 406