After a saga spanning a number of months the midfielder is close to completing a move to the Bundesliga side where he will sign a five-year contract
The 23-year-old has been the subject of ongoing interest from the Bavarian giants in recent months but a deal for the Spaniard has finally been struck, making him the most expensive player in Bundesliga history.
An agreement between the two sides appeared close until recently when the transfer hit a snag with a number of complications in the negotiations between the two sides.
These have now been resolved as Bayern will leave a cheque for €40m in Madrid where Martinez will go when he visits the Spanish Football Federation (RFEF) to cancel his contract, so every tax and judicial issue will be solved.
The Spain international will sign a five-year contract but has agreed to forego €2m of his salary per year, potentially making the deal €10m cheaper for Die Roten.
Martinez, along with Fernando Llorente, had been left out of the Leones squad that will face HJK Helsinki in the Europa League on Thursday.