The English village of Wall lies near a stone wall that is the border with the magical kingdom of Stormhold. A guard is constantly posted at a break in the wall to prevent anyone from crossing. At the beginning of the story, Dunstan Thorn crosses over the wall and into the Wall Market. There, he meets an enslaved princess named Una, who offers him a glasssnowdrop in exchange for a kiss. Nine months later, the Wall Guard delivers a baby to Dunstan, saying his name is Tristan.
Eighteen years later, in the royal palace of Stormhold, the king is on his deathbed. He throws a ruby into the sky, decreeing that the first of his fratricidal sons to recover it will be the new king. The gem collides with a star, and they fall together and land elsewhere in Stormhold. Most of his sons have already been killed off by the others. The king's two remaining sons, Primus and Septimus independently search for the gem.
In Wall, Tristan Thorn sees the star fall behind the wall, and vows to retrieve it for the object of his infatuation, Victoria, in return for her hand in marriage. His father reveals to him that his mother is from the other side of the wall, and gives him a Babylon candle that she had left for him, which instantly transports the user to any desired location. Tristan lights it and is transported to the fallen star, a beautiful woman named Yvaine. He promptly chains her to take her home to Victoria.
Three ancient witches in Stormhold also learn of the fallen star and resolve to find her, intending to eat her heart to recover their youth and replenish their magical power. The leader of the witches, Lamia, consumes the remains of the heart they had cut from a star that had fallen centuries before and was captured by the witches. Regaining temporary youth, Lamia hunts down Yvaine and sets a trap for her, magically conjuring an inn in the countryside.
Yvaine is weary and unaccustomed to daytime travel, so Tristan chains her to a tree and promises to return with food. In his absence, a unicorn frees Yvaine, then unwittingly takes her to Lamia's inn. Tristan discovers Yvaine gone and lies down to rest. The stars whisper to Tristan, warning of Yvaine's danger and begging him to save her as the last star who fell was murdered by the three witches and her heart eaten; instructing him to get on a passing stagecoach, which happens to be Primus'.
Tristan and Primus arrive at the inn, interrupting Lamia's attempt to kill Yvaine. Lamia kills Primus, but Tristan and Yvaine escape using the stub of the Babylon candle. Because they are each thinking of their respective homes, the candle takes Tristan and Yvaine into the storm clouds, between the earth and the stars, where they are captured by pirates in a flying ship. They befriend the kind-hearted Captain Shakespeare, who teaches Tristan how to fence and fight, and gives him and Yvaine clean clothing. In return, Shakespeare asks them to pretend to be frightened of him in public, to maintain his image as a fearsome pirate. His crew later catches him wearing women's clothing, but reassure him they have always known he is "whoopsie", and that they don't care.
Septimus arrives at the site of the inn and discovers that he is the last surviving son of the king, needing only to find the stone to claim the throne. He learns that it is in the possession of the fallen star and realises that the heart of a star grants immortality.
After leaving Captain Shakespeare's ship, Tristan and Yvaine make their way to a village near the wall, where they spend the night at an inn. Come morning, Tristan leaves Yvaine sleeping and goes to Wall, bringing with him a lock of her hair, to tell Victoria that he won't marry her, having fallen in love with Yvaine. When the lock turns to dust, he realises that Yvaine will die if she crosses the wall, and he rushes back to save her.
Yvaine wakes up to find Tristan gone, and she starts walking toward the wall, believing that he abandoned her to go back to Victoria. Tristan's mother Una notices Yvaine walking to her doom, so she takes the caravan of her enslaver, a witch named Ditchwater Sal, to the wall to stop her. Lamia arrives and, after killing Sal, captures both Una and Yvaine, taking them to the witches' castle.
Septimus and Tristan both pursue Lamia and meet at the castle, agreeing to work together for the time being. Barging into the witches' castle, Septimus recognises the princess as his long-lost sister. Una and Tristan meet for the first time, and she informs him that she is his mother.
Septimus and Tristan fight the witches, killing two of them, but Lamia kills Septimus using a voodoo doll, then uses it to make his corpse fight Tristan. Tristan disposes of the corpse. Lamia then disarms Tristan in a swordfight and is about to finish him off, when she breaks down over the loss of her two sisters. Lamia seemingly frees Yvaine but instead reveals her feigned defeat to be a ruse meant to bolster Yvaine's broken heart. As the witch-queen bears down on them, Yvaine realises that Tristan's return has left her heartbroken no more. She tells him to close his eyes and hold her tight. As they embrace, her love for Tristan allows her to shine once again, vaporising Lamia in a blinding flash of pure starlight.
Tristan retrieves the jewel that Yvaine was wearing. Una explains that, as her son, Tristan is the last male heir of Stormhold. Tristan becomes the new king with Yvaine as his queen whilst Dunstan and Una are reunited.
Later, after 80 years of ruling Stormhold, they both use a Babylon candle to ascend to the sky, where Tristan also becomes a star. Since Yvaine "gave her heart" to Tristan, the two will live forever in the sky.