* Bayern do not want loan deal
* Alonso to replace injured Martinez (Updates with quotes, details)
BERLIN, Aug 28 (Reuters) - German champions Bayern Munich are close to signing former World and European champion Xabi Alonso from Champions League winners Real Madrid, they said on Thursday.
The 32-year-old midfielder, who on Wednesday announced his retirement from international soccer after winning one World Cup and two European championships with Spain, is considered as a replacement for the injured Javi Martinez.
Bayern finance chief Jan-Christian Dreesen and Matthias Sammer told reporters terms had "basically" been agreed and the player would arrive later on Thursday for a medical.
"We have basically agreed terms with Xabi Alonso. He will arrive today for his medical," Dreesen said. "We are in friendly talks with Real and am confident that in one or two days there will be agreement with Real as well."
He said, however, Bayern were eager to sign him rather than take him on loan with Alonso's contract running out in 2016.
The transfer of Alonso, who will be Bayern's fifth Spanish player along with Pepe Reina, Juan Bernat, Thiago Alcantara and Martinez, comes just one day after the club signed central defender Mehdi Benatia from AS Roma for a reported 25 million euros ($33.02 million).
"This is purely sporting decision because Alonso can instantly help us and boost our quality," Bayern sports director Matthias Sammer said. "He can play top level football for at least two more years."
Martinez has been ruled out for at least six months with a cruciate ligament tear, forcing fellow Spaniard, coach Pep Guardiola, to look for more defensive midfield options.
($1 = 0.7572 euro) (Reporting by Karolos Grohmann, editing by John O'Brien and Pritha Sarkar)