Real Madrid overcame a shaky performance to maintain their fine recent form to defeat Eibar 2-1 at the Estadio Municipal de Ipurua.
Victory means Zinedine Zidane's side have won eight of their last nine matches in all competitions, but still trail LaLiga leaders Barcelona, who have a game in hand, by 12 points.
The home side dominated the first 30 minutes and created several chances to break the deadlock but against the run of play, a delightful Luka Modric pass sliced through the Eibar defence for Cristiano Ronaldo to open the scoring.
Ivan Ramis headed home Pedro Leon's corner to level five minutes after the restart, but Ronaldo finally doubled his tally after previously being denied by two brilliant saves from Marko Dmitrovic to seal all three points.
The hosts raced out of the blocks and went close on two occasions inside the first minute with Ander Capa seeing his effort blocked in the penalty area by Modric before Leon headed over the rebound.
Los Blancos continued to struggle as Eibar pressed and the home side were inches from taking the lead four minutes later when a teasing cross from Takashi Inui nearly found Kike at the near post, but he could not convert.
Eibar went close once more after great footwork in the middle of midfield by Joan Jordan created space for a quick break and after a neat backheel from Inui, Kike fired in a curling effort from the edge of the area, which Keylor Navas was forced to tip around the post.
Azulgranas continued to open up Real as Jordan nodded Leon's free-kick wide of the post on the half-hour mark, but there were signs from the visitors as Gareth Bale was denied by goalkeeper Dmitrovic after being played through by Marcelo.
And the visitors were ahead after 34 minutes when Modric intercepted a pass from Anaitz Arbilla before playing a sumptuous through-ball for Ronaldo to drill home at the near post.
Sergio Ramos thundered a shot wide after good defending from Ramis, while Ronaldo was denied his second goal by a fantastic save from Dmitrovic and Modric fired straight at the Serbian as Los Blancos improved just before the break.
Gonzalo Escalante's cross-shot after the restart forced Navas into a desperate save and from the resulting corner, Eibar levelled as Ramis powered home a free header into the bottom corner.
Real responded immediately with a good passing move resulting in Modric laying off for Ronaldo but his effort flew over the crossbar, before the Croatian dragged another shot wide of the post after a driving run.
Dmitrovic produced another wonderful save to thwart Ronaldo from 12 yards after a great cross from Bale before the Welshman glanced a header just wide of the far post as a second Madrid goal looked imminent.
Karim Benzema came on as a substitute with 20 minutes left to try and force a winner, however it was Eibar who went the closest when Inui headed over from six yards, while Paulo Oliveira shot straight at Navas.
Kike fired just wide following another quick break from the hosts, but the reigning Spanish champions proved their quality to move ahead with seven minutes remaining as Ronaldo headed home Dani Carvajal's brilliant cross.