Real Madrid were five minutes from taking a giant step towards a first La Liga title in five years and Atlético appeared resigned to defeat when Antoine Griezmann suddenly appeared in their penalty area and slipped in the knife.

Pepe had given Real a lead that many thought went close to wrapping up the league early in the second half, Atlético’s hopes seeming to slip way when Fernando Torres was denied one on one by Keylor Navas. That sensation was deepened by the Atlético substitutions made by Diego Simeone, which appeared guided more by rest than inspiring a reaction but, as the clock ticked down and the game drifted, Real failed to kill it. Ángel Correa found Griezmann in the box and he scored his 15th La Liga goal of the season to end the Madrid derby all-square.

It will never make up for Lisbon or Milan of course – exorcising those ghosts will take another European Cup final against their city rivals and a victory too, preferably a cruel one – but for Atlético there would have been lots of satisfaction in this result.

When it comes to Wednesday night against Leicester City in the first leg of their Champions League quarter-final, this can only have enhanced Atlético’s confidence, even if Simeone warned: “They’re a team that was able to win the English league. We know the game will be very tough against a rival that is similar to us. We also know we are not facing the same team that went into the knockout draw.”

For Real, there will be regret and frustration, too. They had chances to seal victory yet at the final whistle two points had been dropped. Barcelona’s surprise 2-0 defeat at Málaga in the evening game will have softened the blow. Barça, three points behind having played a game more, come here in a fortnight. “I was disappointed we didn’t get the second goal, and at the way we conceded,” the Real coach, Zinedine Zidane, said.

Pepe had scored the opener and it looked set to be one that would finally end Atlético’s three-year winning run in this stadium, the longest in La Liga history, and take Real close to the title. This is Pepe’s final season at the club and soon afterwards he went off injured. As he went, he was given a standing ovation, departing a hero whose work was done. His goal looked decisive, the kind of goal that defines Real, but in the final minutes they drifted – and they were caught.

Simeone had said his side would have to be careful with set plays. Real’s delivery is so precise, their power in the air unmatched. There is a reason Toni Kroos has their most assists, eight from dead balls, and why the contribution from defenders has been so significant. If it has been Sergio Ramos before – he is Real’s third top scorer – this time it was his central defensive partner, Pepe heading in Kroos’s delivery from the right seven minutes into the second half.

It had not been Real’s first chance and they deserved their lead. The best had arrived just before the half hour when Karim Benzema exchanged passes with Cristiano Ronaldo and drew a sharp save from Jan Oblak, who reached out an arm and deflected the shot over. Then Luka Modric slipped the ball to the left for Ronaldo, who rolled it under his studs and then struck it hard beyond Oblak but Stefan Savic was there too, dashing back to somehow head the shot off the line. From the corner, Gareth Bale’s header was stopped by the goalkeeper.

Atlético had responded, Griezmann shooting surprisingly early as he ran at Pepe late in the first half and drawing an excellent stop from Navas. Yet Real had the upper hand even if they did not yet have the lead and the second half began with two Ronaldo headers, one drifting just wide, the other making a chance for Benzema who was blocked by Oblak at close range. Then Pepe scored. At the other end, Torres went clean through but Navas saved.

And that, it seemed, was that. Real, who could have finished it, lost control and Atlético took a step forward. Until, with five minutes to go, Correa saw the pass and Griezmann made the run.