L.C.
My son just turned three and while two seemed fairly easy 3 has had more challenges. Other than being consistent and letting him know your expectations and the consequences of such actions I am not sure. However, perhaps it like the experimentation of innapropriate words. IGNORE it and see if that helps. Perhaps, since he knows it gains him attention, albeit negative he continues to do it. My son just started to spit as well, although usually in the bath. I try not to pay much attention to it (since he needs to figure out how to spit out toothpaste sometime soon).
Try ignoring it and see what happens. If he's spitting in places that need to be cleaned up, rather than make a big deal about spitting maybe say, whoops, spitting in the house isn't good lets clean it up and make him wipe it up. I think barnali's response is great and goes a bit further with my idea. Soap.. while might be affective, in the short term, I personally don't believe soap, hotsauce or any punishment that hurts truly gets across the right message. Positive redirection, in the long run I believe will end with better results. Good luck.
Good luck
L.