Luis Suarez scored twice in the second half either side of a Raphael Varane own goal to send the Catalans through and keep their treble hopes alive.
Madrid had gone into the second leg with a slight edge following a 1-1 draw at Camp Nou, but they failed to best Marc-Andre ter Stegen with some clear-cut chances in the first half.
Vinicius Junior was the biggest attacking threat in some cagey opening minutes, seeing a shot well blocked by Ter Stegen after earlier having a penalty appeal waved away.
Ter Stegen again came to Barca's rescue 10 minutes before the break, denying Karim Benzema on the half-volley, before Vinicius steered the ball over the bar from Sergio Reguilon's low cross.
However, 50 minutes in, Barca's attack finally came to life. Ousmane Dembele raced away from Dani Carvajal and cut the ball back for Suarez, who side-footed first time past Keylor Navas at the left-hand post.
Ter Stegen made a flying save to keep out Reguilon's header as Madrid stepped up their urgency in pursuit of an equaliser, but the result was put beyond them 69 minutes in when a sliding Varane turned the ball into his own net under pressure from Suarez.
With hope draining from among the home fans, Suarez rubbed salt into Madrid's wounds with a chipped penalty four minutes later, leaving Madrid out of the competition and no doubt eager to avenge the defeat in Saturday's LaLiga showdown.