Brazil beat Germany 2-1 to reach the semifinals of the Under-20 World Cup on Saturday, with substitute Maicon coming off the bench to score both goals.

Lewis Holtby put Germany ahead in the 73rd minute, but with two minutes remaining Maicon exploited a gap in the German defense and beat goalkeeper Ron-Robert Zieler at his near post.

A mix up among Germany’s defenders in the first minute of injury time allowed Maicon space and he expertly lobbed Zieler.

“That’s football. We lost and we can’t change it — we have to look forward,” Germany striker Richard Sukuta-Pasu said. “I’m very proud of the team. We played very well here.”

Brazil will play either Costa Rica or the United Arab Emirates in the semifinal. They play later Saturday.

“The Germans took the first step and got the goal. But my players stayed calm, and that’s very important,” Brazil coach Rogerio Lourenco said. “I knew Brazil didn’t deserve to be defeated, and we went on to win the match.”

Germany coach Horst Hrubesch was very happy with his players’ performance but expressed a little disappointment.

“We had been controlling the game up until the (Brazilian) goal,” he said. “But we made a mistake and it cost us the match … But as a team, the players progressed very well and we enjoyed a great atmosphere here.”

Both teams struggled under Cairo’s late afternoon heat in a slow-paced first half of little invention and few chances.

Seconds before the break, Sukuta-Pasu found space but shot straight at the goalkeeper Rafael.

Sukuta-Pasu continued to look like Germany’s most threatening player, and his header from Bjorn Kopplin’s left-wing cross forced a brilliant save from Rafael in the 54th minute.

Rafael denied Sukuta-Pasu again in the 61st, sprinting off his line to dive at his feet after he had latched on to Lewis Holtby’s pass.

“Football is always crazy. You give all that you have and you lose,” Sukuta-Pasu said. “The goalkeeper was good, so was the Brazil team.”

Zieler saved Douglas Costa’s shot moments later, while Rafael dived to his left to keep out Sukuta-Pasu’s shot in the 71st.

Germany took the lead when Semih Aydilek crossed to the back post and no Brazil defender tracked Holtby’s run, allowing him time to plant his header past the stranded Rafael.

But Brazil never panicked and Douglas Costa’s expert pass split the German defense, and Maicon finished in style.

Germany’s players looked nervous as soon as extra time began. Lars Bender misjudged a pass over the top — thinking Zieler was coming to collect it — and Maicon nipped between them and lobbed the goalkeeper brilliantly.

Bender and Zieler screamed at each other, showing Germany was losing its composure.

Brazil substitute Wellington Junior dropped to his knees in prayer at the final whistle, exhausted striker Alan Kardec lay on his back for several minutes, and captain Giuliano high-fived Brazilian fans and sprayed water over them.