This is pretty much age appropriate behavior for this age. he's testing the boundaries.
my son, who will be 3 in january,,takes drinks and then will let them spill out of his mouth onto his shirt.. and he laughs.. my daughter who will be 2 in two weeks, just did this same things, in a restaurant, to my husband. took a drink of punch and as my husband was right in her face, spit it at him. a older couple sitting by us just laughed,, knowing, i'm sure how kids are.
I'm not one that's big on physical discipline. So what we do is we take the drinks away. we tell them that's not acceptable. your milk/punch/juice is for drinking, you have to swallow it. if you spit it out/let it run out of your mouth again, i'm taking the drink away. i give them one chance. but i repeat it a few times consectively. if they do it again, i take away the drink. i may give it back to them towards the end of dinner/lunch what ever the case may be. my daughter still throws her sippy on the floor, all the time, drives me nuts!!! i remind myself, this too shall pass.
we take it away for that reason as well.. they just laugh after doing these things.
try the taking something away method.. see if that works. it has seems to work better for my son lately than time outs. time outs worked with him at first, now not so much..
it's hard at first to switch the brain and know what to say quickly when they are doing something they shouldn't be doing, but once you have a few things in mind, especially if they are misbehaving but wanting something, that's simple. but there is a price for everything. you just have to find his.
good luck,, i remind myself daily, this will pass, and then older moms tell me to savor it right now.. haha..