Sounds like an odd combination of things...
- she is experimenting with her mouth and what it can do (similar to my daughter discovering what happens if she holds her mouth OPEN after taking a sip of milk!)
- she is reacting to attention it gets
One or both, perhaps.
If you totally ignore it, it may not stop because it is unaddressed.
If you punish it, it may not stop because of the attention it gets.
My best suggestion is to hang a uncomfy - kind of bib on her neck every time she spits, and explain - very calmly - that spitting is not nice, and that it is to catch the spit so her clothes do not get wet, and when she stops spitting she will not have to wear the bib anymore. Don't act mad, or a big deal, but insist she wear it til the spitting episode is over (perhaps up to 5 minutes maximum). Repeat as needed, taking care to be consistant. If she rips it off, give warning of a time out and follow through if necessary. Always stay calm and never show anger or frustration. Easier said than done, I know! But it is important.
Eventually she will make the connection and stop spitting. But as with any change, do not expect miracles... it may take a week or weeks even. But persistance will pay off.
Good luck!