| Odion Ighalo scored twice to help Granada move into a stronger position in the fight for survival [EPA]
Villarreal and Granada moved closer to ensuring their topflight status in the Spanish league next season with victories on Tuesday.
Villarreal ended a three-game winless run with a 3-1 victory at Sporting Gijon, who are still fighting relegation and seven points behind their opponent with two rounds to play.
Granada are one point ahead of Villarreal after beating Espanyol 2-1. That means Sporting need to pass Rayo Vallecano, who are at Mallorca on Wednesday, to stay up.
Zaragoza also need to beat Levante on Wednesday to maintain their slim chances of staying up.
Rayo Vallecano are six points head of Zaragoza and Sporting. Also on Tuesday, recently relegated Racing Santander salvaged a 1-1 draw at Getafe for their 19th straight game without a win.
Santander, who will finish last and go down to the second division, haven't won a match since January 7.
Sporting had won two straight games but trailed in the 19th minute when Bruno Valero gathered the rebound from his saved shot and passed for Mario Gaspar to shoot beyond goalkeeper Juan Pablo Colinas.
Sporting equalised in the 39th through Alberto Lora's shot from outside the area. But Villarreal led again by the 43rd after Gregory Arnolin's poor challenge on Marco Ruben inside the area led to Marcos Senna's penalty.
Hernan Perez was allowed space to score past Colinas in the 56th, but Villarreal gave the hosts hope when Cristian Zapata headed a ball straight into the path for Alejandro Galvez to score in the 85th.
Police had to intervene to calm the Villarreal bench at the end with tempers running high because some players were hit by objects thrown by the crowd as stoppage time stretched to seven minutes.
Villarreal secured an important victory in a difficult season in which they lost Italy striker Giuseppe Rossi to injury and failed to win a single game in Europe or the Copa del Rey.
Granada also moved away from the drop thanks to a pair of first-half goals by Odion Ighalo at their Carmenes Stadium, with Didac Vila giving Espanyol hope when he surprised goalkeeper Julio Cesar with a long-range shot in the 54th.
But Cesar was solid after that as Granada took a big step toward remaining in the top flight for a second straight season by moving eight points clear of Sporting Gijon and Zaragoza.
In Madrid, Venezuela striker Nicolas 'Miku' Fedor put Getafe ahead through a 59th-minute penalty after Santander's Pape Diop had struck the woodwork with his own spot kick.
Diop made amends for his first-half miss in the 69th minute as the Senegalese midfielder equalised by converting Jairo Samperio's pass at the Alfonso Perez Coliseum.
Real Madrid can secure their 32nd league title - and first since 2008 - with a victory at Athletic Bilbao on Wednesday, when three-time defending champions Barcelona play Malaga. Madrid lead Barcelona by seven points with three
games remaining for both teams.