Unconvincing Real Madrid survived a huge scare against bottom side Rayo Vallecano when they conceded two second-half penalties but held on to secure a nervy 3-2 victory in La Liga on Saturday.

Real were flying when a Cristiano Ronaldo double and a goal from Karim Benzema put them 3-0 ahead shortly after halftime at Rayo's Vallecas stadium in the Madrid suburbs.

However, Carlo Ancelotti's expensively-assembled side were unable to control the match against their lowly city neighbours and were left reeling when Jonathan Viera struck twice from the spot in three minutes after fouls by Pepe and Marcelo.

A valiant Rayo came close to an equaliser several times and Real goalkeeper Diego Lopez saved his team when he tipped an Alberto Bueno shot on to the post in the 65th minute.

Real's defensive failings will concern Ancelotti but the win trimmed the gap to second-placed Atletico Madrid to two points ahead of Atletico's game at home to Athletic Bilbao on Sunday.

Unbeaten champions Barcelona are top with 34 points from 12 matches after their 1-0 win at home to Espanyol in Friday's Catalan derby, with Atletico on 30 and Real on 28. 

It was a stirring performance from Rayo in front of their vociferous fans and overshadowed another fine effort from Real's world record signing Gareth Bale, whose start in Madrid has been disrupted by injury.

The $135 million Wales winger followed up Wednesday's two goals and two assists in the 7-3 win at home to Sevilla when he set up Ronaldo and Benzema with excellent crosses.

In the earlier kickoff, Real Sociedad showed off their attacking prowess ahead of Tuesday's Champions League match against visitors Manchester United when the Basque club won 5-0 at home to 10-man Osasuna to climb to seventh.

Source: Agencies