New Zealand, ranked sixth, had scoring opportunities, but both midfielder Steve Edwards and striker Hugo Inglis were guilty of squandering opportunities.
Martin Zwicker doubled Germany's lead four minutes from halftime helped by soft defending, then in a hectic two minutes, Hayward got his first goal but Christopher Zeller responded with a penalty corner goal in the last movement of the half.
That was a killer for New Zealand, who then conceded further goals to Zwicker and Benedikt Furk (crrt) before Hayward's late double, which pushed him to the top of the scoring chart at the cup.
The women's Black Sticks, ranked fifth, play fourth-ranked Australia tonight (crrt) and must win to have a chance of advancing to the last four.
Their 4-1 win over Japan yesterday, with a brace from midfielder Anita Punt and one each to Sophie Cocks and Katie Glynn, left them level on goal difference with the Australians but they lost midfielder Rose Keddell to a broken thumb.