Germany twice threw away the lead and had a player sent off before Felix Uduokhai gave the team a 3-2 victory over Saudi Arabia in men’s Olympic football on Sunday.
Uduokhai headed in Max Kruse’s corner in the 75th minute.
Nadiem Amiri gave Germany the lead but Sami Al-Najei equalized after goalkeeper Florian Müller could only parry a shot from Salem Al-Dawsari.
Ragnar Ache restored the lead in the 43rd but Al-Najei equalized again. A foul on Al-Najei saw Amos Pieper sent off in the 67th before Uduokhai gave Germany its first win in Japan.
Germany has three points in Group D, a point behind both Brazil and Ivory Coast. Saudi Arabia is last with zero points.
Earlier, Facundo Medina scored to give Argentina a 1-0 victory over Egypt.
The defender netted from a low shot seven minutes into the second half as Argentina recovered from its opening loss to Australia in Group C.
Argentina will face Spain on Wednesday while Egypt, which has one point, plays Australia.