The Messenger of Allah ﷺ saw some spittle on the wall facing the qiblah. He scraped it off, then turned to the people and said, "When one of you is praying, he should not spit in front of him, for Allah is in front of him when he prays."
أن رسول الله ﷺ رأى بصاقا في جدار القبلة، فحكه ثم أقبل على الناس فقال: إذا كان أحدكم يصلي فلا يبصق قبل وجهه، فإن الله تبارك وتعالى قبل وجهه إذا صلى.
Malik narrated it in the qibla chapter (4) from Nafi, from Ibn Umar, mentioning something similar.Bukhari narrated it in the prayer chapter (406) from Abdullah bin Yusuf, and Muslim narrated it in the mosques chapter (547) from Yahya bin Yahya Tamimi, both of them from Malik with the same wording.