After his father dies in combat during the last months of the Spanish Civil War, young Carlos is brought to an isolated orphanage in 1939. The orphanage, which also serves as a school to the resident children, is home to several dozen other boys, as well as Carmen, the world-weary headmistress with a prosthetic leg, Dr. Casares, the kind and intellectual assistant administrator, Alma, a teacher, Jacinto, a hired hand, and Conchita, Jacinto's fiancee and an employee of the institution.
Carmen, who is concerned about the expenses of caring for yet another boy, mentions the stash of gold bars she keeps in the building and how she would prefer to be rid of it, as she cannot buy anything with it in its current form, nor divulge its existence to any outsiders during this volatile wartime. A large bomb is lodged in the dirt at the center of the courtyard, having been dropped from a warplane months before.
It was deactivated before it could detonate, but was impossible to pull from the ground. Carlos is befriended by two boys his age, Galvez and Owl, with whom he shares his toys and comic books. On his first night at the orphanage, Carlos is dared by an older boy, Jaime, to sneak to the kitchen for water after their pitcher spills in the dormitory.
Carlos agrees, but dares Jaime to accompany him. As the boys cross the courtyard, Jaime whispers that he believes the bomb is still active, as he can hear its "heart" ticking within. The boys reach the kitchen, but Jaime sneaks back to the dormitory, leaving Carlos alone. Carlos hears a chilling whisper from an unknown source, which tells him eerily that "Many of you will die."
Frightened, Carlos dashes outside, but is caught by Jacinto. At breakfast the next morning, Dr. Cesares demands that Carlos give up any accomplices who snuck out with him the previous night. Carlos refuses to rat Jaime out, and takes full blame. Later, Jaime confronts Carlos by the cistern under the chapel, in the presence of a few other boys.
Though Jaime now holds a higher respect for Carlos, he still feels threatened by the newcomer and pulls out a knife to prove his dominance. In the ensuing scuffle, Jaime falls into the cistern. One of the boys shouts that Jaime cannot swim, and Carlos dives in to save him. Jacinto, the hired hand, appears, breaks up the ruckus, and demands to know the owner of Jaime's knife, which had fallen to the floor.
Carlos once again takes the blame, and Jacinto slices Carlos' cheek as a warning before threatening him into secrecy. The boys are all shaken by the incident, but Jaime begins to trust Carlos at last. Later on, Carlos talks with Dr. Caseres, who is treating his cut. Casares shows Carlos how the bulk of the money is made for the orphanage: He sells the spiced rum that is used as a preserving fluid for aborted or stillborn fetuses.
He claims that many believe it carries a power that cures many ailments, including impotence. Casares is seen drinking the liquid, suggesting that he suffers from this himself. He and Carmen, the widowed, solemn headmistress, share an unspoken mutual love, but it is insinuated that Casares is ashamed of his lack of skills as a lover. Carmen, meanwhile, is having a loveless affair with the much-younger Jacinto.
It is revealed that Jacinto has been at the orphanage since he was a boy, and harbors a passionate hatred for it. He works on the property along with his fiancee Conchita, but his violent side is shown through the way he treats the boys; threatening and sometimes hurting them. Jacinto knows of the stash of gold hidden at the orphanage, and uses his sexual relationship with Carmen as an opportunity to take her keys and search the building for the loot.
Carmen is deeply ashamed of fulfilling herself through Jacinto, and suspects that he may have sinister motives. The boys, meanwhile, tell Carlos of the ghost that they believe haunts the orphanage. A boy called Santi, a recent resident and friend of Jaime's, had vanished on the night the bomb was dropped. Some say Santi fled the orphanage in fright and was killed by cutthroats.
Strange sighing noises are heard at night, and the boys believe it is the ghost of Santi (while in actuality, it is Carmen and Jacinto in an adjoining room). Carlos decides to locate the ghost himself, after recalling the strange voice he had heard in the kitchen, whispering "Many of you will die." He sneaks out again that night, and encounters the ghost: a pale, delicate figure of a young boy with blood flowing upwards from a wound in his head, as if underwater. The ghost pursues Carlos back into the building, and a terrified Carlos spends the night hiding in the linen closet.
Later on, after flipping through Jaime's sketchbook, Carlos finds a drawing of a ghostly figure labeled "Santi," leading him to suspect that Jaime knows more about the subject than the other boys. After witnessing some harsh war brutality in the village nearest to the orphanage, Dr. Casares convinces Carmen that they must evacuate the children to a safer location. Jacinto hears of this plan and confronts Carmen, demanding the stash of gold and crassly bringing up their sexual relationship in front of Dr. Cesares.
Enraged, Casares turns a gun on Jacinto and forces him out of the building. As the orphans and faculty prepare to leave, Conchita discovers Jacinto pouring gasoline around the kitchen, in which he had placed numerous other cans of fuel, and preparing to ignite it. Horrified, she threatens him with a gun, and shoots him in the arm when he mocks her. Furious, Jacinto throws his lit cigarette to the floor, starting a raging fire, and flees the building.
Conchita alerts Carmen and Casares, who order the children out of the building before the many cans of gasoline in the kitchen explode. Carmen and fellow-teacher Alma attempt to stifle the blaze, but fail to prevent the devastating explosion. Alma is swallowed by the inferno, and many of the children are killed (just as the ghost had predicted). An injured Casares finds Carmen, mortally wounded, inside the wrecked building, and tearfully stays with her as she dies.
He and the surviving boys, including Carlos, Jaime, Galvez, and Owl, remain in the charred orphanage, with Casares promising not to leave them. He sets up a chair by a front window and waits there with a shotgun for Jacinto's return. The following night, Jaime finally tells Carlos the details of Santi's disappearance. Jaime and Santi had been collecting slugs at the cistern, when by chance they spied Jacinto attempting to open the safe where the gold was kept.
Jaime ran and hid, but Jacinto cornered Santi and attempted to threaten him into keeping his mouth shut about what he had seen. In anger, Jacinto shoved Santi against a stone wall, resulting in the boy receiving a severe head injury and sending him into shock. Jacinto, panicking, tied stones to Santi with ropes before sinking the body in the cistern. A terrified Jaime emerged when the coast was clear and ran into the courtyard, only to have the bomb land several feet from him moments later.
Jaime explains that he is no longer scared of Jacinto, and will kill him if he ever returns. Conchita, having survived the explosion, is making the long walk to the nearest town for help when she meets Jacinto and his two cronies driving back to the orphanage to claim the gold. Jacinto threatens her with a knife, telling her to apologize for shooting him. Despite knowing the danger of angering him, she insults him, and he stabs her to death. Carlos has one more encounter with Santi's ghost, and is no longer afraid after hearing the story of Santi's death.
The ghost quietly demands that Carlos bring Jacinto to him. Carlos agrees. Dr. Casares finally dies of his injuries while still sitting by the window with the gun. Jacinto and his associates reach the orphanage, and imprison the orphans in one room while they search for the gold. The two other men eventually grow impatient and leave, but Jacinto soon uncovers the stash- hidden in a secret compartment of Carmen's prosthetic leg.
The orphans know that Jacinto will kill them once he finds the gold, but Jaime encourages them to fight back, as Jacinto is only one man. The boys fashion weapons from sharpened sticks and broken glass, and escape their room (with help from the ghost of Casares). They attack Jacinto in the cellar, stabbing him multiple times and pushing him into the cistern where he had deposited Santi's body.
Jacinto attempts to escape the pool, but is weighted down by the gold bars tied to his belt. Santi's ghost appears from the depths and drags Jacinto to his death. Having vanquished the enemy and escaped with their lives, the remaining boys leave the orphanage and begin the long walk to town. Dr. Casares's ghost watches them from the doorway.