The 24-year-old Vazquez came up through Madrid’s youth system before playing last season at Espanyol on loan.
Espanyol exercised a clause to purchase Vazquez, but Madrid then reached a deal with the Barcelona-based club to buy him back.
Both clubs had reached a preliminary agreement over the player on Tuesday.
Vazquez is Madrid’s third move of the summer as they look to reinforce their squad under new coach Rafa Benitez.
They have also brought midfielder Casemiro back from loan to FC Porto as well as completing the transfer of defender Danilo from the Portuguese club.
Vazquez scored four goals in 39 matches for Espanyol last season, helping them reach the semi-finals of the Copa del Rey.
However, he will now have to compete with Cristiano Ronaldo, Gareth Bale and Karim Benzema for playing time.