Madrid were also facing the prospect of being dumped out of the competition after Juventus scored three times at the Santiago Bernabeu and were looking to force extra time.
But Zinedine Zidanes side were awarded a penalty in injury time after Mehdi Benatia fouled Lucas Vazquez, and Cristiano Ronaldo converted to send Madrid through.
And Marcelo used Madrids latest triumph as an opportunity to fire a shot in Barcelonas direction.
We should face and we did everything possible to go through, said Marcelo.
What happened to Barcelona wasnt going to happen to us because were Real Madrid.
Madrid are now in Fridays draw for the Champions League semi-final and could face Liverpool, Bayern Munich or Roma.
More: Real Madrid