A heavily changed Real Madrid side made a slow start at Estadio Riazor with Jose Callejon coming closest to scoring in the first half when he headed Kaka’s cross wide at the far post.
Deportivo took the lead on 35 minutes when Riki’s stunning shot from a wide area found the top corner, although questions will be raised over Diego Lopez’s positioning as the shot beat him at his near post.
Madrid showed signs of improvement after going behind but Deportivo almost scored again before half-time when Bruno Gama’s low strike was turned away by Lopez.
Carlos Marchena could have doubled Deportivo’s lead when he scuffed wide from a glorious position but the game swung in Real Madrid’s favour when Cristiano Ronaldo and Sami Khedira were introduced as substitutes on the hour mark.
Kaka levelled the tie with a wonderful curling shot on 73 minutes and Higuain stole the three points in the dying moments when he steered in Ronaldo’s cross from close range.
The result moves Real Madrid within a point of second-placed Atletico Madrid in La Liga while Deportivo remain bottom, eight points from safety.