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

Sunan Abi Dawud Book 2, Hadith 84