Germany out of World Cup despite winning finale against Costa Rica

A Kai Havertz double led Germany to a 4-2 victory over Costa Rica on Thursday, but Spain's loss to Japan in the other Group E match condemned the four-time champions to a second-straight World Cup exit before the round of 16.

Germany finished third in the standings, behind Spain on goal difference, with Japan top following their 2-1 win over the La Roja. The result left Japan facing Croatia in the last 16 while Spain will face Morocco.

On a night of unrelenting drama in the desert near Doha, Serge Gnabry scored an early goal to give Germany a 1-0 lead over Costa Rica at half-time, but despite dominating they were unable to add to their lead over the Ticos in the opening 45 minutes.

- Ogden: Germany humiliated with second-straight group exit

- World Cup tiebreakers: What happens if team is level on points?

Hansi Flick's side needed to win to have any chance of avoiding a second-successive group stage elimination and suddenly found themselves behind after Yeltsin Tejeda and Juan Pablo Vargas scored close-range goals to give Costa Rica an improbable 2-1 lead.

"In the first half I was disappointed and very angry at my team and how we allowed the opponent to come back," Flick said after the match. "We wanted to score three or four goals in the first half, but then we made mistakes.

"If we had converted those chances, 16 of them. But the tournament was not decided today for us. We did not have any efficiency at this tournament and that is why we were eliminated"

With the group standings flashing on the big screen of the Al Bayt stadium, Germany grew nervous with the sensational Jamal Musiala twice hitting the post early in the second half.

Germany players react after conceding a goal to Costa Rica in the World Cup.
Germany players react after conceding a goal to Costa Rica in the World Cup.
Getty Images

Manuel Neuer could do nothing 13 minutes after the restart when Tejeda thundered the ball past him on the rebound after he had first saved a Kendall Waston header.

Vargas then bundled the ball over the line in the 70th minute to put Costa Rica in front.

Havertz came off the bench to score twice for Germany to put them back in the lead and Niclas Fullkrug added their fourth, but Spain's loss to Japan sealed the fate of Flick's team, who finished with four points.

It was the first time in their illustrious World Cup history that Germany had failed to win any of their first two group matches -- a 2-1 loss to Japan and a 1-1 draw against Spain -- and despite bagging a win on their last attempt, they will be departing Qatar with dropped heads.

On a historical note, referees Stephanie Frappart, Neuza Back and Karen Diaz became the first all-women crew to oversee a game at a men's World Cup match.