The hosts nearlty took a surpising lead after two minutes but an un-marked Pedro Leon sent a header of the crossbar from close range.
Los Blancos were forced into a first-half change as Nacho replaced Raphael Varane, who sustained a knock to the head in the 28th minute.
The visitors eventually took the lead in the 34th minute through Cristiano Ronaldo's close-range finish from 12-yards out.
Ronaldo nearly doubled Real's lead just before the break but goalkeeper Marko Dmitrović produced a superb to keep out Portuguese's effort from distance.
The home side restored parity five minutes into the second half when Iván Ramis headed home from Leon's cross.
Los Blancos looked to hit back and they went close on two occasions after 63 minutes with Bale forcing Dmitrovic into a save before the Welshman headed wide moments later.
It was open game in the final 20 minutes with both sides showing their intent to get the winning goal.
However, it was Zinedine Zidane's charges got the all important second goal courtesy of a fine header from Ronaldo.