James Rodriguez nets scorcher in 3-0 victory for Real Madrid against Almeria.

Real Madrid’s James Rodriguez from Colombia celebrates after scoring a goal during a Spanish La Liga soccer match between Real Madrid and Almeria at the Santiago Bernabeu stadium in Madrid, Spain, Wednesday, April 29, 2015. (AP)

Real Madrid kept alive their hopes of overhauling La Liga leaders Barcelona when a James Rodriguez stunner set up a serene 3-0 home victory over struggling Almeria on Wednesday.

Barcelona, chasing a fifth Spanish league title in seven years, thrashed Getafe 6-0 at the Nou Camp on Tuesday and have a two-point advantage over their arch-rivals with four matches remaining.

Champions Atletico Madrid stayed on course to secure third place and an automatic spot in the Champions League when Fernando Torres came off the bench and scored a thrilling breakaway goal to clinch a 1-0 win at Villarreal.

Torres nicked the ball away from a defender near the halfway line 16 minutes from time, sped towards the penalty area and rounded goalkeeper Sergio Asenjo before slotting into the net.

Barca have 84 points, with Real on 82 and Atletico 75, six ahead of Sevilla, who won 3-1 at La Liga debutants Eibar to climb above Valencia into fourth.

Valencia can reclaim Spain’s fourth Champions League berth, which carries a place in qualifying for Europe’s elite club competition, if they avoid defeat at mid-table Rayo Vallecano on Thursday.

Almeria held out until the stroke of halftime at the Bernabeu when Rodriguez pounced on a loose ball and lashed a shot into the top corner from just outside the penalty area.

The European champions, depleted by injuries, doubled their lead soon after halftime when Mauro Dos Santos diverted the ball into his own net under pressure from La Liga top scorer Cristiano Ronaldo.

The Portuguese forward failed to add to his tally and stayed on 39 for the season, one more than Barca’s Lionel Messi who struck twice on Tuesday.

Full back Alvaro Arbeloa netted a rare goal to make it 3-0 five minutes from time, his third in 167 La Liga games for Real, when he turned the ball past goalkeeper Ruben Martinez from a Javier Hernandez centre.

“We are not sure that Barca will drop any points but we are certain that we can win our last four games,” Real coach Carlo Ancelotti told a news conference.

“Now we begin a very important phase of the season, when every game is the most important,” added the Italian, whose side face a tough trip to Sevilla on Saturday and play at Juventus in their Champions League semi-final, first leg three days later.

Malaga’s hopes of catching sixth-placed Villarreal and securing a place in the Europa League suffered a setback when they lost 1-0 at Celta Vigo.

Elche pulled away from the relegation zone and dealt a stinging blow to Deportivo La Coruna when they thumped the visiting Galician side 4-0.

Deportivo are 18th, two points behind Almeria and four ahead of 19th-placed Granada, who host Espanyol on Thursday.

Cordoba, beaten 1-0 at Levante on Tuesday, are five points adrift at the bottom and on the brink of relegation.