The holding midfielder had already pulled out of Spain's Confederations Cup squad due to the knock and will be out for around two monthsReal Madrid have announced on their official website that Xabi Alonso has undergone surgery on a groin injury and will consequently be out of action for six to eight weeks.
The Spain international missed Madrid's last two league games due to the injury.
"Real Madrid player Xabi Alonso was successfully operated on this morning for an athletic pubalgia," a Madrid statement reads.
"The surgery was carried out by a specialist in this condition, Dr. Ulrike Muschawek, from the Hernienzentrum in Munich. The operation was supervised throughout by Real Madrid Sanitas Medical Services."
The 31-year-old made 47 appearances in all competitions for Madrid in 2012-13.