The Mystery, Inc. gang visit a Halloween carnival on Halloween night. When the magician "The Amazing Krudsky" does not allow Scooby to see his show, Shaggy and Scooby expose Krudsky as a fraud. Later, the fairy Princess Willow enters Krudsky's tent, where he secretly reveals his wishes to become a real magician. The fairy inadvertently causes Krudsky to notice an entry on the Goblin scepter in a spell book. Krudsky then gets an idea to obtain the scepter and rule the world with it. The fairy is then accidentally captured by Krudsky, who absorbs her magical powers, becoming a real magician.
Meanwhile, Shaggy and Scooby trick-or-treat all night. Their last stop is a spooky looking house which claims to be a "genuine magic shoppe". Inside, they meet the kind Mr. Gibbles, who reveals that magic really does exist. At that moment Willow enters, being chased by Krudsky. Krudsky captures the Princess, turns Gibbles into a rabbit, and steals the magic equipment before leaving. Mr. Gibbles explains to an astonished Shaggy and Scooby that Krudsky, after capturing the good magic of the princess, will now want the bad magic held in the scepter of the Goblin King. Shaggy and Scooby must go into the world of magic via the Grim Reaper Railway, get the scepter before Krudsky can, and return home before sunrise, or else they will be trapped in the magic world forever.
While looking for Shaggy and Scooby, Fred, Daphne, and Velma see Krudsky conversing with the Goblin King through a mirror, where the King agrees to exchange his scepter for Willow at midnight at a clock tower. The three decide to go the the tower and set a trap for the King and Krudsky. In the magic world, Shaggy and Scooby find that everyone is afraid of the Goblin King and will not help them. The Goblin King's two bumbling henchmen, Glob and Glum, attempt to capture Scooby and Shaggy, but they are saved by Jack O'Lantern, a living pumpkin, who leads them to three witches. Along the way, they avoid the Headless Horseman, who was Jack's former body, by heading across a covered bridge. The witches send Shaggy and Scooby on a ride on their flying broomstick towards the Goblin King's castle, but they are shot down by Glob and Glum.
Landing in a fairy village, Shaggy and Scooby find three fairies who help them to the Goblin Kings castle entrance. Using a potion from the witches (made from someone called Scratch), Shaggy and Scooby disguise themselves as Daphne and Velma in order for Glob and Glum to let them into the castle. Only a few minutes away from midnight, Shaggy and Scooby try to run off with the scepter but are caught and sent to the dungeon by the Goblin King, who heads to meet with Krudsky. At the clock tower, Krudsky and the Goblin King are almost through with their trade when Fred, Daphne, and Velma release a trap and run off with the princess.
But the trap only catches the Goblin King, and Krudsky takes the scepter, turning himself into the new Goblin King. After turning the Goblin King into a goose, Krudsky and his goblin army capture Fred, Daphne, and Velma, and he uses his powers to turn them into monsters (Fred a vampire, Daphne a witch and Velma a werewolf respectively). At that moment Scooby, Shaggy, and Jack O'Lantern arrive, having been saved from the dungeon before sunrise by the fairies and the magic broomstick. Jack sacrifices himself to strip Krudsky of the staff, which Scooby uses to break Krudsky's spells. It is revealed that Willow is the Goblin King's daughter. Mr Gibbles brings Jack back to life, and the Goblin King returns to the magic world along with the army, Krudsky, Willow, Jack and Mr Gibbles. One final spell erases the memory of the events from Fred, Daphne, and Velma's minds, though Scooby and Shaggy are allowed to keep their memory as they have proven their courage.