It is narrated from Hazrat Anas (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: Spitting in the mosque is a sin, and its expiation is to bury it.
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 13433