Anas (May Allah be pleased with him) reported:
The Prophet ﷺ noticed spittle in the mosque in the direction of the Qiblah. The signs of disgust were perceived on his face. Then, he stood up and scraped it away with his own hand and said, "When you stand in Salat, you hold communion with your Rubb and He is between you and the Qiblah. Let no one therefore cast out his spittle in that direction, but only to his left or under his foot." Then he caught hold a corner of his sheet, spat into it and folded it up and said, "Or he should do like this."
[Al-Bukhari and Muslim].
وعن أنس رضي الله عنه أن النبى ﷺ رأى نخامة في القبلة، فشق ذلك عليه حتى رؤى في وجهه، فقام فحكه بيده فقال: “إن أحدكم إذا قام في صلاته فإنه يناجى ربه، وإن ربه بينه وبين القبلة، فلا يبزقن أحدكم في القبلة، ولكن عن يساره، أو تحت قدمه” ثم أخذ طرف ردائه فبصق فيه، ثم رد بعضه على بعض فقال: “أو يفعل هكذا” ((متفق عليه)).