Early goals from Gaizka Garitano and Savio Bortolini gave Real a 2-0 lead before Javier Portillo reduced the arrears.

However, Jon Ansotegui killed off the Catalans with a second-half goal.

Promoted Nastic and the long-time top-flight mainstays from San Sebastian have been keeping each other company in the bottom three for most of the season but Real are now four points from safety with four games to play.

Real started well and Mikel Aranburu missed to the right from 25 yards after four minutes.

At the other end visiting goalkeeper Claudio Bravo did well to field a shot from Portillo.

However, the opening goal came in the 12th minute with Aitor Lopez Rekarte providing the pass which enabled Garitano to head his side in front.

Real continued to press forward and doubled their lead 11 minutes later.

Darko Kovacevic played the role of provider with a pass to Savio who scored from the edge of the area.

Juanito Gutierrez nearly made it 3-0 with a shot from 35 yards that was just too high but soon Nastic hauled themselves back into the game.

It was a splendid effort from Portillo who found the net with his left foot from more than 30 yards out.

Portillo could have equalised when he then connected with a corner from Ruben Castro but this time he was wayward with his finish.

Early in the second half Nastic laid siege to the Real Sociedad goal and Portillo was denied again when his header was parried by Bravo.

The hosts were closer still when Carlos Merino rattled the crossbar from close range after another dangerous raid.

However, Real were looking dangerous on the counter-attack when Xabi Prieto forced a fine save from Ruben Chueca in the home goal and next German Herrera missed to the right from close range.

Real duly supplied the killer goal 20 minutes from time with Prieto playing the role of provider and Ansotegui scoring from close range.

The men from San Sebastian could even have extended their lead as Herra forced another save from Chueca.

Kovacevic fired over from long distance before Portillo went close at the other end with a shot that went over.

Real Sociedad still have it all to if they are to escape from relegation but at least Miguel Angel Lotina's side have given themselves a chance.

Nastic are on the brink and their fate could be sealed as soon as next week in what has been a difficult season in the top flight after they won promotion last summer.