Joachim Low’s side drew two and lost two in the inaugural edition of the tournament in 2018-19 but looked to be heading for victory after Timo Werner crowned a wonderful team move in the 51st minute.
Spain were indebted to goalkeeper David de Gea for keeping them in the contest with a string of fine saves and pulled level deep into stoppage time.
Debutant Ferran Torres got to the right byline and Gaya smuggled home a finish from Rodrigo Moreno’s header down.
Toni Kroos’ impeccable deliveries unsettled Spain early on, with De Gea down sharply to keep out a Thilo Kehrer header at his near post.
It quickly became an impressive outing for the under-fire Manchester United goalkeeper, who denied Julian Draxler before flinging himself brilliantly to his right to turn a rasping Leroy Sane effort over the bar in the 18th minute.
In between those two Germany chances, an elaborate mix-up between Emre Can and De Gea’s opposite number Kevin Trapp gave Rodrigo a glorious chance to open the scoring, but Leeds United’s new record signing dithered and the goalkeeper got back to scramble clear.
Luis Enrique’s side found themselves opened up six minutes into the second half.
Ilkay Gundogan launched a gorgeous cross-field pass to debutant Robin Gosens, romping forward from left wing-back. Sane dummied the Atalanta man’s pass and Werner showed slick footwork before dispatching the finish beyond De Gea.
Sane burst clear of the Spain backline with an hour played but wastefully overhit his pass across goal to Werner, who could only fire into the side netting.
Thiago Alcantara, doing much to ensure the visitors controlled large passages of play, thundered a shot just wide from the edge of the box in the 70th minute before the equaliser came from a more unexpected source.
Joshua Kimmich, Leon Goretzka, Manuel Neuer and Serge Gnabry were given this international break to recuperate by Low after inspiring Bayern Munich to Champions League glory.
For the next upcoming event Spain host Ukraine on Sunday while Germnay travel to Switzerland.