Then, after the Prophet ﷺ forbade spitting toward the qiblah—that is, the worshipper’s own direction of prayer—he immediately clarified what is permissible, for this is the Prophetic method and true wisdom: whenever you tell people that something is forbidden, you should also show them what is allowed, lest you shut every door before them. He therefore instructed a person to spit to his left, or beneath his foot, or into his garment and rub one part of it against another. These are three options: he may spit beneath his foot and step on it; or he may spit to his left—yet both of these become impossible when one is inside the mosque, because they would soil it, and the Prophet ﷺ said, “Spitting in the mosque is a sin.” The third option is to spit into one’s garment and then rub the cloth together.
This ḥadith is proof that phlegm is not impure, because the Prophet ﷺ told the worshipper to spit beneath his foot or into his garment; had it been impure, he would not have allowed him to soil his clothes with it. It also demonstrates teaching by practical example: the Prophet ﷺ said, “Or he says—meaning does—like this,” then spat into his garment and rubbed one part against another. His phrase “or he says like this” shows that speech can be used figuratively to refer to an action when instructing.
The narration further indicates that there is no harm in spitting in front of people, especially when the purpose is educational. Finally, it teaches a point of decorum: your clothes should not display anything that people would find repulsive—hence he rubbed the cloth together so that no trace remained and those who saw him would not be offended.