Spitting in the mosque is a sin and it is expiated by burying the spittle.

Sunan Abu Dawud Book 2 Hadith 84

Sunan Abu Dawud #474

Prayer (Kitab Al-Salat) 2:84

Anas b. Malik reported the Prophet(ﷺ) as saying:

Spitting in the mosque is a sin and it is expiated by burying the spittle.

Chapter: Spitting In A Masjid Is Disliked

Grade: Sahih (Al-Albani)