The small Austrian town of Schwaz played host to the two teams, who were contesting the Betway Cup - a trophy that the Hammers were yet to win prior to kickoff.
At the other end, Michail Antonio mustered two half-chances around the half-hour mark, firing straight at the opposition keeper from Marko Arnautovic's delivery and heading over following Robert Snodgrass's cross.
Neither side could open the scoring come the break but West Ham succeeded in breaking the deadlock on 70 minutes, Snodgrass making the run and beating two players in the box before lifting the ball up to the back post, where Toni Martinez was perfectly placed to head home.
With neither side able to find a late winner after 90 minutes, penalties were needed to separate the two.
WEST HAM UNITED (4-2-3-1): Adrian; Zabaleta, Diop, Balbuena, Masuaku; Rice, Noble (Cullen 76'); Wilshere (Obiang 60'), Snodgrass, Antonio (Martinez 60'); Arnautovic
MAINZ 05: Zentner, Donati, Maxim, Kunde, Niakhate, Ujah, Onisiwo, Bussman, Bungert, Baku, Holtmann