The Messenger of Allah (ﷺ) said: Spitting in a mosque is a sin, and its expiation is that it should be buried.
Sahih Muslim Book 5, Hadith 69