"This was without question a complicated transfer," said Bayern chairman Karl-Heinz Rummenigge. "That's why we are even happier that Javi Martínez is finally with us.
"We know that he is a very good player. Over the past days, he has impressively demonstrated that he also has a strong personality, perseverance and a remarkable affinity for Bayern."
Bayern president Uli Hoeness echoed Rummenigge's opinion of Martinez.
"Forty million is a crazy sum," he said. "But we were convinced about the quality."
Martinez joined Bilbao in 2006 from Osasuna B.