Joachim Loew's side will play 2010 world champions Spain in Dusseldorf on March 23, 2018.
Joachim Loew's side will play 2010 world champions Spain in Dusseldorf on March 23, 2018 before facing record five-time World Cup winners Brazil four days later in Berlin.
Germany have yet to qualify for next year's tournament but are well positioned at the top of their group with four wins from four matches, leading Northern Ireland and Azerbaijan by five points.
"These matches against Spain and Brazil will certainly give us a small taster of the World Cup in Russia, where the team will give everything a few months later to defend its title," said DFB president Reinhard Grindel.
"Naturally it would be fabulous if one of these two matches was also the final next year in Moscow," he added.