Seventeen-year-old Gemma Doyle has not been able to return to the magical world of the realms since she defeated her nemesis, Circe, and bound the magic of the realms to herself. Instead, Gemma and her friends Felicity and Ann must spend their days at the Spence Academy for Young Ladies. Gemma and Felicity prepare for their debut in London Society. Ann, a poor scholarship student, must ready herself to work as a governess for her ill-behaved cousins. Adding to Gemma's worries is her desire to see Kartik — the young man from India who saved her life in London. He promised to aid her in her fight to save the realms, but he has yet to return to Spence.
One night, Gemma is given a vision of a young woman and a magical door located in the ruins of the east wing of the school. An unseen force pulls Gemma to investigate the east wing, which is being renovated after a fire caused by members of the Order destroyed it 25 years earlier. The Order is a group of women who used to wield the magic in the realms. In the east wing, Gemma discovers the magical door. She wakes her friends, and they use the door to get to the realms.
Although ecstatic to be back, Gemma faces the wrath of the creatures there because she had promised to share the magic with them. Gemma fears giving up her power before she makes things right in the lives of her friends and family back home. Before leaving the realms, the girls meet with their friend Pippa, whom they feared had fled to the evil Winterlands. Pippa has remained within the realms and has taken several young factory girls under her wing. She secretly begs Gemma to take her across the river to where the dead live so she can leave the realms behind. Gemma agrees, but when the time comes, the land of the dead refuses to let Pippa enter because she has been corrupted by dark magic. To ease her friend's grief at having to live alone in the realms, Gemma gives Pippa a gift of magic.
Back in Spence, Gemma is plagued by visions that warn her to find a "Tree of All Souls." Gemma acts as a detective in order to decipher the dream's meaning. She also struggles with feelings of rejection because Kartik returns and tells her he will not help her with her work in the realms. He stays with the gypsies, who live in the woods outside of Spence and who disapprove of the school renovating the east wing. One of the gypsy elders, Mother Elena, claims the tower is cursed and will bring evil on everyone around it.
Miss McCleethy, a leader of the Order, comes back to Spence as a teacher. She attempts to convince Gemma to work with her and re-establish the Order as the rulers of the magic, but Gemma doesn't trust her. She lies and tells the teacher that she's been unable to return to the realms since she battled Circe.
While visiting her family in London, Gemma is approached by Mr. Fowlson, a kind of protector of the Rakshana (former guardians of the Order). Fowlson threatens Gemma and her family. He wants her to share the magic with the Rakshana, but Gemma claims to have lost her powers. The creatures in the realms continue to pressure Gemma to share the magic with them.
Gemma discovers that the woman she keeps having visions of is Wilhelmina Wyatt, a former Spence student and author of a book about the Order. Miss Wyatt was a mute and a drug addict. The woman insists that Gemma find the Tree of All Souls but can offer no clues as to its location. Desperate for advice in deciding what to do about the realms, the magic and the threats against her family, Gemma seeks help from Circe. Her enemy is trapped in a magical pool within the Temple of the realms. In exchange for some of Gemma's magic, Circe agrees to answer the girl's questions. Circe tells Gemma she must search the darkest corners of her soul in order to truly know herself. Only that way will she be able to control the magic. She also tells her of the location of the Tree of All Souls. Gemma and her friends travel to the Winterlands and find it. There, Gemma has a vision of Eugenia Spence, the founder of the Spence school. Eugenia was a powerful member of the Order. Eugenia sacrificed herself to save the lives of Gemma's mother and Circe. In the vision, Eugenia asks Gemma to find a dagger imbued with great power. With that dagger, Gemma can release Eugenia from imprisonment within the Tree of All Souls and allow her to pass into the realm of the dead.
Kartik arranges a meeting for Gemma with an informant of the Rakshana, but they are double-crossed. Mr. Fowlson surprises them and reveals that Kartik was tortured after he helped Gemma escape from the Rakshana. During that time, he had a vision of his brother, now a creature of the Winterlands. In his vision, that creature killed Gemma. Fearing for Gemma's life, Kartik had stayed away from her. Gemma unleashes her magic on Fowlson, and she and Kartik escape. When they return to Spence, they find the workmen on the east wing in an altercation with the gypsies. Mother Elena has been marking the stonework with blood to ward off evil spirits. The workmen accuse the gypsies of killing two of their men who've disappeared. Gemma discovers that Kartik has been spying on her for Miss McCleethy. She flees to the realms and confronts Circe again, searching for answers. Circe agrees to tell her more about the Order and the Rakshana in exchange for another gift of magic.
Gemma returns to the realms some time later with Ann and Felicity. They discover the beauty of that world is eroding into chaos. The different magical creatures have begun fighting amongst themselves. The centaurs accuse Gemma of conspiring to give the magic to their enemies. She must admit that she has been talking to Circe in secret. The centaurs refuse to help Gemma, and Felicity denounces Gemma's behavior as reckless. Felicity finds Pippa and gives her a gift of ostrich feathers from her debut ball. Pippa is delighted and wants to host a party for the factory girls as well. When Gemma claims to be too tired to use her magic to transform the decrepit castle they live in into a place of beauty, Pippa summons her own magic. Gemma learns that Pippa has been going to the Winterlands to make sacrifices to the Tree of All Souls in order to gain power. Felicity and Ann discover they now have the ability to come and go into the realms without Gemma's aid.
Gemma takes Kartik into the realms. The two share a passionate vision before they sneak into the Winterlands. At the Tree of All Souls, they see Kartik's brother performing a blood sacrifice in order to strengthen the power of the creatures within the Winterlands. He plans to sacrifice Gemma to control both the realms and the world of the mortals. Later, Gemma discovers that Circe has freed herself from the Temple pool and is planning to join the Winterlands' creatures. Pippa has also aligned herself with the malignant evil from that part of the realms.
Through her detective work, Gemma figures out that Eugenia Spence has betrayed the Order and has become one with the Tree of All Souls. It is her spirit that cries out for Gemma's blood in order to free the Winterlands. On the anniversary of Eugenia's birthday, the veil between the realms and the mortal world is opened at the east wing of Spence. The demons of the Winterlands attack the school to bring Gemma back as a sacrifice. In a final battle, the creatures of the realm join with Gemma to defeat the creatures of the Winterlands. She gifts them with magic in order to aid them in the fight. Gemma stabs the Tree of All Souls, releasing the magic within, but is stabbed by Kartik's brother before she can escape. If her blood reaches the ground it will complete the sacrifice, and the Winterlands creatures will win. Kartik rushes to rescue her and offers himself as a willing sacrifice instead. The souls and magic from the tree enter him, and Kartik is transformed into a new tree that is forced to stay in the realms forever. The magic is returned to the land so all creatures can draw from it.
Gemma can only "free" a soul trapped in a tree; the soul can then cross over to the realm of the dead. Since she believes Kartik is still alive within the tree, and the tree's power restores the beauty of the realm, she won't release him, which would kill him. Gemma, therefore, must leave him and go on with her life. She returns to London and makes her debut. Afterward, she tells her father she does not want a place in British society. Instead, she intends to travel to New York City to make a new life for herself.