Germany's late goal against Spain enabled them to keep their World Cup dreams alive.
Niclas Fuellkrug's late equaliser snatched Germany a morale-boosting 1-1 draw with Spain in a heavyweight World Cup clash on Sunday, leaving both sides' hopes of qualifying for the last 16 still in the balance.
Alvaro Morata's flicked finish had Spain on course to secure qualification from Group E, but the electric Jamal Musiala and Fuellkrug combined to foil La Roja and restore some German pride.
Costa Rica's surprise win over Japan earlier eased some pressure on Germany after their shock loss to the Asian side, but they were unable to capitalise for large periods in a battle for the ball against Spain.
The four-time world champions suffered a humiliating group-stage exit in Russia four years ago, and Morata's strike at Al Bayt Stadium had them on the ropes, but Werder Bremen striker Fuellkrug finished brilliantly to divide the points.
Spain leads Group E with four points, ahead of Japan and Costa Rica with three each, while Germany has one, with a final round of matches to come.
"We still have room for improvement, but we can hope that everything turns out well in the final game," Fuellkrug told the German TV network ZDF.
Germany coach Hansi Flick rejected suggestions his side had been distracted in their shock opening defeat by Japan because of their pre-game protest against FIFA "silencing teams" and the taut opening exchanges quickly ensured all focus was on the football.
When Luis Enrique's side seemed to have lost their grip on the game, they broke the deadlock.
Morata, on for Torres, finished clinically at the near post from an inviting low cross from Jordi Alba after 62 minutes.
It looked like it was enough for the 2010 champions, but Fuellkrug — on only his third international appearance —decided otherwise, sneaking in behind substitute Alejandro Balde and lashing past Simon with seven minutes remaining.
"They are a great team, they had one big chance and they took it," Morata told Spain's TVE.
"They man-marked our best players and they are a team that could be among the favourites to win the World Cup, so we have to take the positives and keep working."
Spain, who need a point to be certain of progressing, face Japan on Thursday, while Germany need to beat Costa Rica and hope La Roja do not lose.