The game got off to a dramatic start with Inigo Martinez firing Sociedad ahead after just two minutes but Joaquin Larrivey grabbed an equaliser from the penalty spot two minutes later. Ruben Pardo had the home side ahead on the stroke of half-time but second-half goals from Alberto Bueno and Ruben Rochina handed Rayo all three points leaving them in the relegation zone on goal difference alone.
Malaga also claimed a vital win in the battle to avoid the drop as they claimed a 2-0 victory at fellow strugglers Osasuna. Samu fired the visitors ahead in the first half but Osasuna were handed some hope when Jesus Gamez was dismissed for a second booking just after the break.
However, Javi Gracia's men failed to take the initiative and Nordin Amrabat doubled the lead to move Malaga above their opponents on goal difference, three points above the drop zone.