A 2-2 draw on the night against their bitterest rivals was enough to put Pep Guardiola's team into the next round.
Madrid almost took the lead inside the first minute when Gerard Pique gave the ball away to Gonzalo Higuain. However, the striker could only fire wide when he had the goal at his mercy.
As Madrid went on to dominate the half, Higuain was foiled when Jose Pinto saved his volley before Cristiano Ronaldo's low drive was saved by the goalkeeper's legs.
Mesut Ozil almost broke the deadlock with 25 minutes played, but his spectacular effort came back off the woodwork.
Higuain had another opportunity minutes later when his shot was saved by Pinto after he had intercepted the keeper's pass.
Despite Madrid's dominance, it was Barca who took the lead just before half time when Pedro was on hand to slot into the net following Lionel Messi's winding run.
Their lead was doubled minutes later as Dani Alves lashed in a fearsome drive from outside of the area after the visitors had failed to clear their lines.
With their advantage, the hosts were able to control large parts of the second half, but Madrid got themselves back into the match on 68 minutes when Ronaldo rounded Pinto before converting.
Jose Mourinho's side drew level on the night four minutes later as substitute Karim Benzema smashed the ball in from close range after some poor Barcelona defending.
As the home side grew increasingly nervous knowing that another Madrid goal would knock them out, Messi nearly put them back in front with ten minutes to play with a dipping free kick.
In a frantic final five minutes, Los Blancos were reduced to ten men when Sergio Ramos picked up a second yellow card.