The Messenger of Allah ﷺ said, "Spitting in the mosque is a sin, and burying it is a good deed."
قال رسول الله ﷺ: التفل في المسجد سيئة، ودفنه حسنة.
Ahmad (22243) and Ibn Abu Shayba (2/365), and from his route Abu Yaala as in Ithaf Khayra (1471), narrated it from Zayd bin Hubab, who said, Husayn bin Waqid informed us, who said, Abu Ghalib narrated to me, that he heard Abu Umama saying, and then he related the hadith. Tabarani also narrated it (8092, 8093, 8094) through Husayn bin Waqid with the same chain, and in some of his versions it reads, "and its atonement is its burial," instead of his saying, "and its burial is a good deed." Its chain is hasan because of Abu Ghalib, the companion of Abu Umama, concerning whom there is disagreement. Daraqutni said, "Trustworthy," and also said, "A Basran whose narrations are given consideration." Ibn Saad and Nasai graded him daif. Abu Hatim said, "He is not strong." Ibn Hibban said, "It is not permissible to rely on him except where he agrees with the trustworthy narrators."I say, such a narrator's hadith can be graded hasan when supported by corroborating reports, just as Hafiz also graded it hasan earlier from the hadith of Anas and others.