Bale was forced off just before the hour mark of Real's 2-1 win over Sporting Lisbon on November 22.
"Our player Gareth Bale has successfully come through the operation he underwent today after suffering an injury to the peroneal tendons in his right ankle," the Spanish giants said in a statement.
"The operation was carried out at London's King Edward VII Hospital by Dr. James Calder and Real Madrid Sanitas' Dr. Mikel Aramberri, under the supervision of Dr. Jesus Olmo, head of Real Madrid's medical department," it added.
Bale was forced off just before the hour mark of Real's 2-1 win over Sporting Lisbon on November 22 as the European champions secured their place in the last 16 of the Champions League for a record 20th consecutive season.
The Welshman was diagnosed with a "traumatic dislocation of the peroneal tendons in his right ankle".
Spanish media reported at the time that he would be out for at least two months.
It means Bale will miss the rest of 2016, the Club World Cup in Japan and probably the first leg of the Champions League last 16 tie.