You could also fill a glass with warm water, add a bit of salt to it, and stand him in front of the toilet. Have him take a sip, and spit it in the toilet... again and again and again and again until the glass is done. Perhaps he will lose an interest in spitting.
Tell him that spitting should be done only in the toilet. Every time he spits, make him wipe it up and send him into the bathroom to spit and spit. It's up to you if you want to make him spit salt-water, or plain water. Mild salt water isn't harmful, but you wouldn't want him to swallow it. It is unpleasant to taste though, so might discourage the spitting. You could put a small shake of red pepper in the water for him to spit - that would get his attention.
We always try to make house rules in the positive. Instead of "No Spitting" you would say, "Spit in the bathroom toilet, only". Instead of "no hitting", we say, "Hands are for loving touches". Instead of "no kicking" we say, "Feet belong on the floor."
Good luck! This will pass.