The story opens with an explosion inside a stone tower that bursts open a wall and leaves the place in flames. A young red-haired girl races away, a small pouch in her hand. Climbing to the end of a large tree branch, she’s cornered there, but escapes when a broom flies by and she leaps on it. The people left behind send magical creatures after her, but she escapes.
Sometime later, Mary Smith moves into the northern English country estate of her Great-Aunt Charlotte ahead of her parents. The bored, friendless girl tries to make herself useful through chores, but she repeatedly messes up. A local boy named Peter teases her for both her clumsiness and her wild red hair, which she hates.
Tib-cat and Gib-cat, Peter’s cats, lead Mary to some mysterious glowing flowers, one of which she picks. Zebedee, the estate gardener, identifies the flowers as “fly-by-night”; legend has it that witches covet the flower for its magical power. The next day, Gib-cat disappears and Mary follows Tib-cat to go look for her. Tib-cat leads her to a broomstick ensnared in a tree’s roots. Mary frees the broomstick, but accidentally bursts a fly-by-night bulb on it. The bulb releases magical power in the form of a blue gelatinous substance, making the broomstick come to life and enabling Mary to ride it like a witch. The Little Broomstick whisks Mary and Tib-cat away to a complex of buildings hidden in the clouds, known as Endor College for witches. It soon becomes clear that this is the place and the people from the opening scene.
Head mistress Madam Mumblechook assumes Mary is a new pupil with Tib-cat as her familiar, and takes her on a tour of the college. The tour reveals a campus with modern technology and conveniences, where witches take courses in the magic arts alongside fields of science such as chemistry. During the tour Madam introduces Mary to Doctor Dee, the college’s renowned chemistry teacher. Mary finds herself able to perform advanced spells such as invisibility. Madam and Doctor Dee become convinced that Mary is a prodigy, because of her performance as well as her red hair, which turns out be a distinguishing feature among the best witches.
At Madam’s office, Mary finds a spell book hidden behind a picture of a fly-by-night. Mary admits that her magical ability comes from fly-by-night, and that Tib-cat actually belongs to Peter. Madam’s attitude to Mary suddenly changes, but she still lets Mary return home once Mary turns over a piece of paper with Peter’s address on it. She’d used it to deliver a package for her great-aunt. That night, Madam sends a message to Mary informing her that she’s kidnapped Peter, and demands that Mary bring the fly-by-night bulbs to her. She and Tib-cat quickly fly back to Endor with the bulbs, but Madam and Doctor Dee imprison her in Doctor Dee’s transformation spell lab. Mary finds Peter locked in the lab with her, and discovers that Doctor Dee has been experimenting on animals, including Gib-cat, transforming them into fantastic creatures. In the spell book, Mary finds a spell that can undo all magic, and she uses it to undo all the transformations and to unlock the lab. They try to escape on the Little Broomstick, but Madam and Doctor Dee recapture Peter. Before she is carried off, she vows to come back for him.
The Little Broomstick takes Mary to an isolated cottage on a tiny island that seems to be alive. Voices welcome here home, lighting lanterns and opening the door, and acting as if she’s coming back. Within the cottage, Mary finds notes on transformation spells and a mirror that Great-Aunt Charlotte uses to contact her. Charlotte uses a sort of flashback image – Mary and her younger self walk through visions of the past – and she reveals that the cottage was her previous home, and she used to be a red-haired pupil who excelled at Endor. But one day Charlotte found fly-by-night on the campus, leading Madam and Doctor Dee to obsessively pursue a project to use the flower to transform all humans into witches. When one of their experiments disastrously failed, Charlotte decided to escape Endor, taking the flower with her. Charlotte begs Mary to use her last bulbs to return home, but Mary vows to rescue Peter instead. Madam shows up and tries to catch Mary, but she manages to slip away, and races back to the school.
Mary returns to Endor and finds Madam and Doctor Dee trying to use the flower to transform Peter into a witch. But the experiment fails again, leaving Peter trapped within a gelatinous monster that rampages across the campus. Mary gets the spell book to Peter, and he uses it to undo the failed experiment as well as all of Madam and Doctor Dee’s research. Mary and Peter fly home, with Mary throwing away her last bulb and saying she does not need magic.