At the beginning of the film, we learn the story of Princess Moanna of the underworld, who wanders into the mortal world, where she is doomed to live, and eventually die, as a human. However, in 1944, she is given new life as a young mortal girl, Ofelia, who is traveling with her pregnant but sickly mother, Carmen, to live with Carmen's new husband, a ruthless Francoist soldier named Vidal.
Ofelia sees a group of fairies and follows one to a labyrinth outside the encampment where Vidal lives. She also meets the housekeeper, Mercedes, and a doctor, Doctor Ferreiro, who work for Vidal, but are secretly helping the guerrilla rebels living in the forest nearby. In the labyrinth, a faun tells Ofelia she is the reincarnation of Princess Moanna and gives her a book with three tasks she must complete in order to be welcomed back into the underworld. The first task is to feed stones to a giant toad who lives inside a very old tree, and then getting a key out of his belly. She completes this rather grotesque task and returns home. When the faun next visits Ofelia, he gives her a piece of chalk for the next task. He also gives her a mandrake root to put under her sickly mother's bed to help her heal.
Ofelia’s next task is retrieving a dagger from an underground lair where a child-eating monster sits at a table full of food. In the process of procuring the dagger, Ofelia accidentally eats some food off the table, which is expressly forbidden, but still manages to escape.
Meanwhile, in the non-fantastical world, Vidal and his soldiers capture some rebels. In the process of keeping the rebels captives, Vidal realizes that Dr. Ferreiro is helping the rebels, and kills him. Carmen and Vidal find the mandrake root under the bed and dismiss it as fanciful child's play. When Carmen throws the root in the fire, she gives birth and dies in the process.
When the faun hears that Ofelia ate from the table of the underground monster, he stops helping her, but eventually decides to give her a second chance, telling her to escape Vidal's house with her baby brother. When Ofelia brings her baby brother to the labyrinth, the faun tells her to spill her brother's blood, but she refuses. Vidal finds her and shoots her, and Ofelia's own blood is spilled, which is enough to open the portal and bring her to her rightful place in the kingdom of the underworld. Meanwhile, Mercedes mourns the young girl's death.