Gonzalo Higuain scored an 88th-minute winner as Real Madrid came from a goal down to sneak past a gutsy Deportivo La Coruna.
The hosts, bottom of the Primera Division, took the attack to a slightly weakened Madrid side, with Luis Pizzi and Riki causing plenty of problems, and the latter broke the deadlock 10 minutes before the interval.
Depor had several chances to extend their lead, but were made to rue some poor finishing when Kaka equalised in the 73rd minute, with Higuain sealing victory for the visitors two minutes from time.
Angel Di Maria was given his marching orders in the 90th minute after picking up two bookings, but it mattered little to the result.
Real coach Jose Mourinho took the opportunity to rest several first-team stars prior to Tuesday's Copa del Rey clash with Barcelona, with a Champions League last-16 second leg at Manchester United also looming large on the horizon.
The most notable absentee was Cristiano Ronaldo, who could only watch from the bench as his side were outplayed in the first half.
Deportivo came out all guns blazing and Madrid goalkeeper Diego Lopez looked shaky, spilling Riki's fierce effort before defender Pepe cleared the danger.
Mourinho's men were lacking a cutting edge up front, but the hosts were vibrant and Pizzi narrowly missed the target after cutting in from the right.
But Depor brokethe deadlock in the 35th minute when Riki latched on to Pizzi's pass, cut between defensive duo Ricardo Carvalho and Pepe and beat Lopez at his near post.
Any thoughts that the hosts would sit back and try to protect their lead were banished when Pizzi cut past Pepe before curling the ball over Lopez, only for full-back Marcelo to spare his team's blushes and head off the line.
Riki then twisted and turned past Carvalho, with his shot narrowly missing Lopez's right hand post, while Madrid's goalkeeper also had to deny Portuguese winger Bruno Gama's fizzing strike before the interval.
Madrid emerged energised after half-time, with Callejon heading wide and Marcelo's goalbound strike blocked in the box.
Perhaps sensing an opening, Mourinho made a triple substitution as Ronaldo, Mesut Ozil and Sami Khedira entered the fray.
Madrid's star player made an immediate impact, slotting through for Higuain, who thought he had drawn his side level but was flagged offside.
The visitors were now on top and deservedly levelled matters when Kaka fired low into the net from just outside the area in the 73rd minute.
With the bit between their teeth, Madrid went in search of a winner, and Ronaldo leapt in front of his marker but could only head narrowly wide.
But the Portugal international would play a key role in the 88th-minute winner, collecting the ball from Kaka and squaring for Higuain, who was left with the simplest of tap-ins.
Madrid's night was slightly soured by Di Maria's sending off when the winger was given a second booking for not advancing ten yards at a set-piece.