كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(13)
Chapter: The prohibition of spitting in the masjid, during prayer and at other times. The prohibition of a praying person spitting in front of him or to his right
(13)
باب النَّهْىِ عَنِ الْبُصَاقِ، فِي الْمَسْجِدِ فِي الصَّلاَةِ وَغَيْرِهَا ‏‏
Sahih Muslim 552 b

Shu'ba reported:

I asked Qatada about spitting, in the mosque. He said: I heard Anas b. Malik say: I heard the Messenger of Allah (ﷺ) say: Spitting in the mosque is a sin, and its expiation is that it should be buried.
حَدَّثَنَا يَحْيَى بْنُ حَبِيبٍ الْحَارِثِيُّ، حَدَّثَنَا خَالِدٌ، - يَعْنِي ابْنَ الْحَارِثِ - حَدَّثَنَا شُعْبَةُ، قَالَ سَأَلْتُ قَتَادَةَ عَنِ التَّفْلِ، فِي الْمَسْجِدِ فَقَالَ سَمِعْتُ أَنَسَ بْنَ مَالِكٍ، يَقُولُ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ ‏ "‏ التَّفْلُ فِي الْمَسْجِدِ خَطِيئَةٌ وَكَفَّارَتُهَا دَفْنُهَا ‏"‏ ‏.‏
Reference : Sahih Muslim 552b
In-book reference : Book 5, Hadith 70
USC-MSA web (English) reference : Book 4, Hadith 1125
  (deprecated numbering scheme)