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].
Arabic/English book reference: Book 1, Hadith 652