Cristiano Ronaldo hit a hat-trick as Real Madrid won 3-2 at Sevilla.
Ronaldo netted twice within a minute late in the first half to put Los Blancos in command, but their advantage was reduced to a single goal before the break when Carlos Bacca scored from the penalty spot after an ill-advised challenge by Sergio Ramos.
Ronaldo headed in a fine Gareth Bale cross from a tight angle to calm the visitors' nerves midway through the second period, only for Vicente Iborra to set up a tense finale. But Madrid held on to become the first side to beat Unai Emery's side on their own turf since February 2014.
The result kept Carlo Ancelotti's side two points behind Primera Division leaders Barcelona, who triumphed 8-0 at Cordoba earlier on Saturday, with just three games of the season remaining. Sevilla stayed fifth.
Ancelotti said: "It's an important win, because it allows us to keep fighting for La Liga and will give us confidence for Tuesday because of the way we played. Cristiano was the star for a team that were given a really tough game and played well.
"It was a very complete match by both teams. We played against very solid opponents who had a support that got right behind them. It wasn't easy to win, we're very happy and we keep on fighting. I don't think it's a coincidence that no-one had won here."