Real Sociedad scored deep into injury time to earn a 3-3 draw with Real Madrid in a pulsating clash at San Sebastian.
Sociedad produced 27 attempts on goal but came up against an inspired Diego Lopez in the Real Madrid goal.
Gonzalo Higuain and Jose Callejon put Madrid 2-0 up against the run of play, but Xabi Prieto (penalty) and Antoine Griezmann drew Sociedad level.
Sami Khedira appeared to have won it with an 80th minute strike but Prieto popped up at the far post in injury time to secure a point for Sociedad.
It could yet prove a valuable point for Sociedad in the race for the fourth Champions League place. They now trail Valencia by two points, but Los Ches will have to win their final game to be sure of qualifying for European football’s premier club competition.
Real took the lead after some slapdash play from Mikel González whose attempted pass to the left was cut out by Higuain who carried the ball into the area and slotted calmly beyond Claudio Bravo.
Imanol Agirretxe came close to replying immediately, after he got clear of Ricardo Carvalho, but he lifted the ball over Lopez’s bar.
Lopez, Real Madrid’s man-of-the-match by some distance, showed terrific reflexes to deny Griezmann whose header at the back post seemed destined for the net.
Lopez’s reactions were again tested as he saved from Agirretxe, while a touch from Greizmann took the ball away from his team-mate, with the striker waiting to pounce at the far post.
Real Madrid actually started the stronger in the second-half and Kaka curled a highly presentable opportunity wide, before Lopez produced another elastic save to keep out a fierce effort from Agirretxe.
Iñigo Martínez experienced a heart-in-mouth moment at the back as he almost headed a lofted through ball past his own goalkeeper.
Jose Mourinho, in his penultimate game as Real Madrid coach, saw his side go 2-0 up when Kaka’s inviting cross was calmly converted by Callejon at the far post.
Xabi Prieto handed Sociedad a lifeline when he slotted a penalty past Lopez after Khedira was penalised for a handball in the area.
Griezmann almost made it 2-2 when he rounded Lopez, only to fire wide before the inspired goalkeeper produced a good save from a Diego Ifran free-kick. The ball fell to Agirretxe who knocked it wide with the goal gaping.
Sociedad scored the equaliser their vibrant display merited when Carlos Martinez curled in a low cross and Griezmann was on hand to score his 10th goal of the season.
In a topsy-turvy encounter, Real went straight up the other end and scored, with Khedira playing a neat one-two with substitute Mesut Ozil before dinking the ball into the far corner.
Lopez made another spectacular save to push Xabi Prieto's bullet header over the crossbar.
It could have been 4-2 when Angel Di Maria curled in an inviting ball from the left for Higuain but the Argentine striker slid his shot wide at the far post.
Griezmann had an effort controversially ruled out for offside before Agirretxe spurned another great chance as he headed wide at the near post, but Sociedad were not to be denied.
Captain Xabi Prieto rose to head a cross at the far post, the ball rebounded off Lopez and hit Prieto as Sociedad earned a point that was the least their performance merited.
Valencia, who won 1-0 against Granada, now lead Sociedad by two points in the race for the final Champions League place and are in the driving seat heading into the final round of fixtures.