M.F.
BOTH of mine (son AND daughter) went through this at about that age. It's like a lot of other toddler behavior -- it's a new "skill" and he'll do it til he's worn it out, unfortunately. But, your response to it should be consistent, so he'll wear it out sooner! Spanking probably isn't necessary, but I would certainly take his drink away as soon as he does it. Just don't "give in" and give it back to him until his next meal/snack time. So, if you serve him breakfast and he spits his first sip of milk, take the cup away and say "No spitting, I'll put your milk away til later." Put it in the fridge. If he throws a fit about not having milk, just calmly remind him that he shouldn't spit his drink and reassure him that he'll get it at the next meal. He may even be too ticked off to eat his breakfast. That's fine too. Remove him from the table/high chair and breakfast is over. It's likely that lunch could go the same way too, but there's a good chance dinner will be peaceful and spit-free. If he's really strong-willed (like my first child!) you could have a whole day of it, but 2-yr-olds can't hold out long. They fall into line pretty quickly once you stick to your guns!
Just remember that he's like a little scientist and it's his job to test ANY boundary. If the boundary is firm, he'll give up and leave it alone (and look for a new boundary to test...). If the boundary wiggles AT ALL, he'll keep pushing it.