Anas b. Malik reported the Prophet(ﷺ) as saying:
Spitting in the mosque is a sin and it is expiated by burying the spittle.