Is it possible that the person who passed you had called on your left and you didn't hear him? I know that sometimes (not often) I yell "on your left" but people act surprised when I go by. Typically, these people are talking to a friend or wearing headphones, but once in a while I go by a single person without headphones who seems startled. Maybe I don't yell loud enough ... maybe they can't hear well.
Even though it is frustrating to be startled on a trail or road, spitting on someone in retaliation is not the correct response. You're probably fortunate that you didn't spit on someone who has a similar approach to problem solving....