Alberto Carroza had fired the visitors into a shock lead as Atletico conceded for the first time at home since early October.

Atletico then passed up a host of chances to level before the break as Jose Gimenez had a goal harshly ruled out for offside, while Adrian Lopez blasted a penalty over the bar.

With such an advantage from the first-leg, Atletico boss Diego Simeone had handed a night off to the majority of his first-team regulars and had to turn to 18-year-old Hector Hernandez in his search for an equaliser.

The young forward duly delivered when he turned home Adrian's cross 12 minutes from time.

Sant Andreu looked like they may still hold out for a famous draw, but they were cruelly denied with the last action of the game as Toby Alderweireld headed home Gabi's free-kick deep into stoppage time.

Atletico will now face Valencia or Gimnastic in the next round.

Real Sociedad sealed their place in the last 16 with a convincing 4-0 win over Algeciras thanks to goals from Javi Ros, Haris Seferovic, Antoine Griezmann and Carlos Vela to seal a 5-1 aggregate victory.

And La Liga sides Almeria and Real Betis also progressed despite being held at home on the night by lower league Las Palmas and Lleida respectively.