The Spain international's future had been shrouded in doubt in recent months as his previous deal was set to expire at the end of the season.
However, the former Liverpool man has finally committed his future to the Santiago Bernabeu outfit, signing fresh terms to keep him at the club until the summer of 2016.
Alonso took to his official Twitter account to reveal the news, stating: "I'll be continuing at my home for two more years. It's a pleasure to tell you this. I'm very very happy."
Esta seguirá siendo mi casa por dos años más. Un placer comunicároslo. Muy muy feliz ¡¡Hala Madrid!! pic.twitter.com/hURnYccz3W— Xabi Alonso (@XabiAlonso) January 8, 2014
The club also confirmed the news, announcing that Alonso will face the press at the Santiago Bernabeu at 13:30CET on January 10.
Alonso, who joined the club in 2009, made it clear earlier this month that he was eager to win more trophies with Madrid - including the elusive 10th European title.
The 32-year-old has played 12 times in all competitions to date this season but is currently sidelined with an inner ear problem and was forced to sit out the win over Celta Vigo on Monday.