The Prophet ﷺ saw some phlegm on the qiblah wall of the mosque and scraped it off with a pebble. He then forbade anyone to spit in front of himself or to his right, saying, "Let him spit to his left or under his left foot."
حدثنا سفيان عن الزهري عن حميد بن عبد الرحمن
أن النبي ﷺ رأى نخامة في قبلة المسجد فحكها بحصاة ثم نهى أن يبصق الرجل بين يديه وعن يمينه وقال ليبصق عن يساره أو تحت قدمه اليسرى
Its chain of transmission is sahih, its narrators are leading authorities, and the hadith is found in similar form in Bukhari 1/509, no. 408, Fath, in the Book of Prayer, chapter on scraping mucus with a pebble from the masjid, and in Nasai 2/51, in the Book of Masjids, and in Humaydi 2/319, no. 728, and in Abu Awana 1/402.