The home side opened the scoring after 35 minutes when Riki found the back of the net, with that scoreline still standing at the interval.
Madrid improved in the second half, however, and were level 20 minutes from time when Kaka curled an effort into the top corner.
There was still time for late drama, as Gonzalo Higuain tapped home in the final minute to secure all three points for Madrid.
Here Sports Mole dissects the 90 minutes of action between the two La Liga rivals.
On target: 5
On target: 5
Was the result fair?
A point apiece would have been a fair result this evening. Deportivo controlled the first period, but were second best for large periods in the latter stages. Three points would have moved them off the foot of the table, but they just could not hang on in the latter stages. Madrid's away form continues to be a concern for those involved with the Spanish champions.
It is no exaggeration to say that Deportivo could have been home and over the hill at the interval. They led with that Riki strike, but Pizzi had two clear chances to extend their tally. They spent large periods without the ball in the second period, with the pressure eventually telling in the latter stages.
Real Madrid's performance
Jose Mourinho's side were poor this evening. From the very first minute their passing was a yard short, while their squad players failed to have any sort of influence on the match. They were up against a team that has shipped goals all season, but they needed to bring on their big guns to pick up all three points.
Sports Mole's man of the match
Riki: Regardless of the fact that he scored the opening goal of the match, it was Riki's all-round display that impressed this evening. He no longer has that explosiveness, but his intelligence and use of the ball shined through. He was everything that his team needed him to be.
Biggest gaffe of the match
Diego Lopez has been impressive since arriving at Real Madrid in January, but he had a horror this evening. Riki's strike was hit with plenty of power, but the goalkeeper should not have been beaten at his near post.
Alfonso Alvarez had a fairly productive 90 minutes of action this evening. The Spaniard was quick on the scene when he deemed it necessary, but was prepared to keep his cards in his pocket for large periods. Neither side will have had many complaints about his performance.
Deportivo: The basement outfit will attempt to record an overdue win when they welcome Rayo Vallecano next Saturday.
Real Madrid: Madrid are in Copa del Rey semi-final action away to Barcelona on Tuesday before facing the Catalan outfit in the league next Saturday.