Pan's Labyrinth

In a fairy tale, Princess Moanna, whose father is the king of the underworld, visits the human world, where the sunlight blinds her and erases her memory. She becomes mortal and dies. The king believes that eventually, her spirit will return to the underworld and so, builds labyrinths around the world in preparation for her return.
In post-Civil War Spain in 1944 (after Francisco Franco has come into power), protagonist Ofelia travels with her pregnant but sickly mother Carmen, to meet Captain Vidal, her new stepfather. Vidal, is the son of a famed commander who died in Morocco, believes strongly in Falangism, and has been assigned to hunt down republican rebels.
A large stick insect, which Ofelia believes to be a fairy, leads Ofelia into an ancient stone labyrinth, but she is stopped by Mercedes, Vidal's housekeeper, who is secretly supporting the rebels. That night, the insect appears in Ofelia's bedroom, where it becomes a fairy and leads her through the labyrinth. There, she meets the faun, who believes she is the reincarnation of Princess Moanna. He gives her three tasks to complete in order for her to acquire immortality. Meanwhile, Vidal murders two local farmers detained (erroneously) on suspicion of helping the rebels.
Ofelia completes the first task -- retrieving a key from the belly of a giant toad -- but becomes worried about her mother, whose condition is worsening. The faun gives Ofelia a mandrake root, which eases Carmen's illness. Accompanied by three fairy guides, Ofelia then completes the second task -- retrieving a dagger from the lair of the Pale Man: a child-eating monster. Although she was warned not to consume anything there, she eats two grapes, awakening the Pale Man. He eats two of the fairies and chases Ofelia, but she manages to escape. Infuriated at her disobedience, the faun refuses to give Ofelia the third task.
Vidal tortures a captive rebel, and then kills Doctor Ferreiroâwho is also a rebel collaboratorâafter he euthanized the tortured prisoner. Vidal catches Ofelia tending to the mandrake root, and Carmen throws it into the fire, where it writhes and screams in agony. Carmen immediately develops painful contractions and dies giving birth to a son. Soon after, Vidal discovers that his housekeeper Mercedes is a spy. Ofelia is locked in her bedroom, and Mercedes is taken to be tortured. However, she frees herself, stabs Vidal, and rejoins the rebels.
The faun returns to Ofelia and tells her to bring her baby brother into the labyrinth. Vidal pursues her. The faun tells Ofelia that to open the portal to the underworld requires the blood of an innocent, which the faun suggests means a few drops of her baby brother's blood. Ofelia refuses to harm her brother; for further disobeying his orders, the faun refuses to help her.
Vidal finds Ofelia talking to someone (the faun) who Vidal cannot see. Vidal takes the baby from her arms and fatally shoots Ofelia; then, when he reaches the labyrinth's entrance, he is surrounded by the rebels who have taken over the outpost. Knowing that he will be killed, he hands the baby to Mercedes, demanding that she tell his son the exact time of his father's death. Mercedes replies that the child will never even know his name. Her brother Pedro kills Vidal.
Mercedes enters the labyrinth and comforts the dying girl. Drops of Ofelia's blood fall down the center of the spiral stone staircase onto an altar. Ofelia then appears in a golden throne room. The king of the underworld says she passed the final test, which was to choose to spill her own blood rather than that of her baby half-brother. The faun praises Ofelia for her choice, and addresses her as "Her Majesty". The queen of the underworld, her mother, invites Ofelia/Moanna to sit next to her father, and rule at his side. We then again see the stone labyrinth, where Ofelia smiles as she dies.
The epilogue completes the tale of Princess Moanna, stating that she ruled wisely and left quiet traces of her time in the human realm, "visible only to those who know where to look".

Question: Who comfort the dying girl
Answer: Mercedes