Neymar's Brazil meanwhile will have to negotiate a group including Switzerland, Costa Rica and Serbia.
Holders Germany will face Mexico, Sweden and South Korea as they try to retain the title for the first time since Brazil in 1962.
Lionel Messi and his Argentina team which struggled to qualify will play European debutants Iceland, Croatia and Nigeria.
England must negotiate Kevin de Bruyne's Belgium, surprise packages Panama and Tunisia after they were placed together in the draw in the Kremlin.
Spain's other opponents in a tough-looking Group B are Morocco and Iran.
Así queda el grupo de #España en la #CopadelMundo #WorldCup #Soccer #Fútbol #FIFA #Russia2018 #Rusia2018 #FinalDraw Entre 32 Selecciones ¡Celebrando el amor al Fútbol en el mundo ? ⚽️?entero! pic.twitter.com/SEzECOvBOM
— Real Club España (@futbolrce) December 1, 2017
France will play Australia, Peru and Denmark in Group C.
Host nation Russia will face Saudi Arabia in the tournament-opening match on June 14th in Moscow