Barcelona overcame a spirited display from Malaga to claim a place in the last four of the Copa del Rey with a 6-4 aggregate win.
With the clubs tied at 2-2 after the opening match at the Nou Camp, Pedro gave Barca a ninth-minute lead only for Joaquin to level matters four minutes later.
Gerard Pique restored the Catalan side's advantage four minutes into the second half, but the home side again fought back with a goal from Roque Santa Cruz after 68 minutes.
However, late strikes from Andres Iniesta (76) and Lionel Messi (80) finally put the tie to bed with a 4-2 scoreline on the night.
Barcelona meets Real Madrid in the semi-finals while a 1-1 draw with Real Betis was enough to send Atletico Madrid through to the last four, 3-1 on aggregate.
Looking to defend a 2-0 first-leg advantage, Atletico extended that with a goal on the stroke of half-time from Diego Costa.
Betis was never in the match and a last-minute penalty from Jorge Molina was little more than a consolation for the host.
Next up for Atletico is Sevilla, with a spot in the final up for grabs.
Barcelona has announced that defender Adriano has signed a new four-year contract.