The year: 1944. The place: a makeshift military encampment in the verdant countryside outside of Madrid, where a company of Spanish soldiers is methodically eliminating the few remaining resistance fighters trying to topple the fascist government of General Franco. The resistance fighters are fueled by the belief that with the landing on D-Day, the Americans will take down Franco as well as Hitler. They are wrong.

Into this scene comes a limousine bearing the pregnant and recently married Carmen (Ariadna Gil), along with her young daughter, Ofelia (Ivana Baquero). Carmen’s first husband was killed in the Spanish civil war under suspicious circumstances. She has since wed the nefarious Captain Vidal (Sergi López), a dyed-in-the-wool fascist who longs to have a son carry on his name.

Ofelia, who sees Captain Vidal for what he is, despises him and refuses to call him father. His contempt for her is just as palpable. To protect herself from his callousness and cruelty, Ofelia retreats into a fantasy world of fairies and fauns, a world that revolves around a hedge-lined labyrinth near the military headquarters that neatly reflects the perilous turns and dead ends of the child’s life.

Pan’s Labyrinth is written and directed by Guillermo del Toro, a Mexican filmmaker who has made his reputation with horror films and futuristic sci-fi pictures (Cronos, Hellboy, Blade II). His latest film represents a major step forward in its look (an enthralling mix of fairy-tale aesthetic and surrealism), emotional subtlety and attention to detail, especially when we find ourselves in the middle of Ofelia’s vivid fantasy world.

When Ofelia first travels the bumpy road to the encampment with her morning-sick mother, she spots a buzzing dragonfly and a worn roadside sculpture with a broken-off hunk by its side. In the first sign of her retreat into her subconscious, she imagines that they are a magical fairy and the long-lost missing piece of an ancient puzzle. Just as intriguing are scenes with a giant toad and a pale man with prying eyes in the palms of his hands, as if he is gazing at life through his stigmata.

The more realistic aspects of the tale are also gripping. They involve the brutal captain, his terrified men, his submissive bride and the handful of secret resistance sympathizers who work for him, led by the crafty Mercedes (Maribel Verdú, from Y Tu Mamá También), whose brother is off in the woods somewhere, risking his life for Spanish freedom. These are the sections of the film that make it clear this is an “adult fairy tale” (don’t be fooled by the film’s childlike poster), filled with violence, sadism and torture.

Not that Ofelia’s own world is a walk in the park. One might assume that her fantasy world would be a withdrawal from the harshness of life into a gentle and understanding universe. But del Toro seems to be suggesting that even a child’s imaginary world smacks of menace and danger. For instance, the faun that provides instructions on how to achieve her goal (she has been told she is a long-lost princess from the underworld) is quite nasty; he pretends to be kind and thoughtful but is looking to take advantage of the girl’s innocence. If Ofelia disobeys one of his difficult commands, he turns into a vengeful creature much like her wicked stepfather.

For all its cutting-edge technology, Pan’s Labyrinth is a throwback to 1970s Spanish cinema, when similar tales of retreat from the cruel adult world played out in such classic films as Victor Erice’s Spirit of the Beehive (1973) and Carlos Saura’s Cria! (1976), both starring the legendary child actress Ana Torrent. Though del Toro may not yet be in the same league with those directors, he makes an impressive statement with this terrifying and beautiful tale of innocence lost and humanity gained.