Berlin (AFP) - German champions Bayern Munich on Thursday announced they had agreed terms with Spanish international midfielder Xabi Alonso for his transfer from Real Madrid.

Bayern said they were finalising the deal with Real with whom Alonso who is under contract with the Spanish side until 2016, but the player was to undergo a medical in Munich later Thursday.

The 32-year-old was a key member of the Spanish sides that won the past two European Championships in 2008 and 2012, as well as their first World Cup in 2010.

However, Alonso's final international tournament ended in huge disappointment as the holders crashed out of the World Cup in Brazil after just two games following defeats to the Netherlands and Chile in the group stage.

Alonso on Wednesday announced his retirement from international football.