The Prophet ﷺ said, "Spitting in the masjid is a sin, and its atonement is to cover it over." And he said, "Its atonement is to bury it."
حدثنا إسماعيل أخبرنا هشام مثله وقال كفارتها دفنها
Its chain of transmission is sahih.