It is narrated from Sayyiduna Tariq bin Abdullah al-Muharibi (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "When you pray, do not spit in front of you or to your right; and if the place on the left is empty, spit to the left, otherwise spit under your foot." And (the narrator) pointed with his foot and scraped the ground (with it) to show it.
Related hadith on this topic