The loss at a stunned Bernabeu spoiled Real's perfect home record of 14 wins in 14 matches this season and ended coach Jose Mourinho's own nine-year unbeaten run in home league matches.

It also handed Barca a chance to stretch their advantage at the top to eight points with eight games left if they can win at Villarreal in the late kickoff.

Joint La Liga top scorer Cristiano Ronaldo, in-form striker Karim Benzema and fullback Marcelo all missed the game through injury and Real initially struggled to create chances against their obstinate visitors.

Gonzalo Higuain, making his first appearance in four months after back surgery, squandered a great chance when he blasted straight at goalkeeper Juan Pablo on the hour shortly after coming on as a substitute.

Gijon grabbed a surprise lead 19 minutes later when Miguel Angel de las Cuevas burst into the area from the left wing and struck a precize shot that beat goalkeeper Iker Casillas to his right and went in off the post.

In a frenetic final few minutes, Real were denied an equalizer by some frantic, last-ditch defending and Sami Khedira had an effort cleared off the line by a defender in the fourth minute of added time.

Real have 73 points from 30 of 38 matches, with Barca on 78 from 29.