my 1st did this, the only thing that helped her from spitting up is to keep her in an upward position for 30 mins before laying her down. you can also talk to your ped sometimes babies can have reflux issues.
My baby had cows milk protein intolerance and did this every time I had dairy (she was breastfed)
It may be the formula, have you tried others? It could be gas as well.. Mommy’s Bliss is my go-to brand