Barcelona controlled possession in the first half but Real were lethal on the counter-attack, taking the lead when Alaba started a flowing move with a tackle and finished it at the other end with a left-footed drive from the edge of the box.
Barcelona manager Ronald Koeman brought on Philippe Coutinho at halftime while strikers Sergio Aguero and Luuk de Jong were also thrown on in the second half as they searched for an equaliser.
With seven minutes of injury time added on, Real doubled their lead when Marc-Andre ter Stegen saved a shot from Marco Asensio from another counter-attack but Vazquez pounced on the rebound to score.
Barca got a goal back in the 97th minute when Sergino Dest crossed to Aguero in the six-yard box and the Argentine tapped in but it proved to be a consolation goal as Real moved provisionally top of LaLiga with 20 points.
Barcelona are five points behind in eighth place.