A barely believable match on a barely fathomable night in a barely comprehensible sport ended with Leon Goretzka’s late goal earning Germany their spot in the last 16.

They finished second in the group and face England next, while Hungary go home after giving a tremendous account of themselves.

In driving Munich rain, Germany started well, but Hungary defended stoutly and showed enterprising intent on the counter. And on 10 minutes, they had something to show for it, Roland Sallai dropping off to cross brilliantly, and Adam Szalai contorted his body beautifully to send a diving header skidding past Manuel Neuer.

Germany pushed for an equaliser but struggled to create while Hungary remained a threat, but then on 66 minutes and out of nothing, Kai Havertz headed home from underreported the bar after Peter Gulasci had come for Joshua Kimmich’s free-kick and missed his punch.

For a second, Germany were into the east 16, but Hungary flew at them directly from kick-off and when Szalai put a ball in between Leroy Sane and Mats Hummels, Andras Schafer burst between them to beat Neuer a second time.