It is narrated from Sayyiduna Anas bin Malik (may Allah be pleased with him) that the Noble Prophet (peace and blessings be upon him) said: Spitting in the mosque is a sin, and its expiation is to bury it.
Hadith Referenceالفتح الربانی / أبواب المساجد / 1345