The European giants will also face Japan as well as the winners of an intercontinental play-off between Costa Rica and New Zealand in Group E.
Spain thrashed Germany 6-0 in a Nations League match last November.
Germany goalkeeper and captain Manuel Neuer said: "It was inevitable that we were going to get a strong opponent from the pot.
"We have negative memories, but something like that doesn't happen to us twice.
"We're confident, we're going to have a good tournament," the Bayern Munich player said. Читать дальше...