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 lead Group E on four points, from Japan and Costa Rica on three each, while Germany have one, with a final round of matches to come.
The only World Cup group-stage clash to pit two former champions against each other lived up to its top billing in intensity and tactical intrigue, with both sides set on trying to dominate possession and press extremely high.
Exciting feature: Check out news exactly for YOU ➡️ find "Recommended for you" block and enjoy!
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.
Flick cut Kai Havertz from his line-up and deployed Thomas Mueller up front after their shocking opening-day capitulation, hoping for a quick reaction.
Poland World Cup squad: Which players will be booting up for the Polish national team in Qatar?
However, Spain almost took the lead in the seventh minute when Manuel Neuer palmed Dani Olmo's powerful drive from range onto the woodwork.
It seemed like they were picking up where they left off after their 7-0 demolition of Costa Rica, but Germany steeled themselves, keeping Luis Enrique's side at bay.
Spain goalkeeper Unai Simon relied on his footwork under pressure as La Roja sought to dominate possession.
One mistake handed Serge Gnabry an opportunity, but he fired wide.
Neuer erred with the ball at his feet too, with Germany similarly looking to build from the back, but Ferran Torres could not capitalise.
Antonio Ruediger powered home a header from a free-kick, but his celebration was cut short after VAR caught him half a step ahead of the Spanish defence, leaving the teams tied at the break.
Germany nearly struck after Joshua Kimmich won the ball back pressing extremely high, but Simon produced a fine save to deny him.
Just 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.
Leroy Sane, on as a substitute after injury, might have won it late on for Germany but was forced extremely wide as he rounded Simon and could not find a finish or produce a cutback.
Spain face Japan on Thursday, while Germany play Costa Rica, needing to win and hoping La Roja do not lose.