In Gatlin, South Carolina, Ethan Wate awakens from a recurring dream of a girl he does not know. In voice-over narration, he describes his enjoyment of reading banned books, his despair of his small-town existence, and his dreams of leaving for college. Arriving for his first day of junior year, Ethan notices newcomer Lena Duchannes, who resembles the girl he has been dreaming about. The other students do not take kindly to her and spread gossip regarding Lena's reclusive uncle, Macon Ravenwood, and suggest that her family includes devil worshippers. Overhearing these whispers, Lena tenses and the classroom windows shatter, amplifying the fears and suspicions of the class and the townspeople at large that she is a witch.
On a drive home, Ethan nearly runs over Lena, whose car has broken down. He gives her a ride home and the two bond over their shared love of poetry and having both lost their mothers. Ethan drops Lena off but later finds a locket and returns to the mansion to give it to her as a present. The touch of a locket triggers a shared flashback to the American Civil War, after which Ethan awakens at his home. Macon disapproves of their growing romance and conspires with Ethan's family friend, Amma, to keep the two separated. However, Ethan continues to pursue Lena until she confesses that she and her family are "casters," who are capable of performing a variety of magical spells such as changing the weather and casting illusions. On her 16th birthday, Lena's true nature will steer her towards either the light or the dark; Lena fears the latter, as it entails being consumed by evil and hurting those she loves. Ethan insists she is responsible for her own choices and reassures her that she is a good person.
Matters are complicated by the arrival of two immensely powerful dark casters who aim to push Lena to the dark: Ridley, Lena's provocative cousin/childhood friend, and Sarafine, Lena's mother, who has possessed Mrs. Lincoln, the mother of Ethan's friend Link. Sarafine foresees that Lena will become an even more powerful caster and intends for Lena to use her newfound power to purge the Earth of humans, leaving Casters to rule in their wake. Lena and Ethan use the locket to re-experience the whole flashback, which reveals their ancestors, caster Genevieve Duchannes and mortal Confederate soldier Ethan Carter Wate were in love. Ethan Carter was shot in battle and Genevieve revived him using a forbidden spell that caused her to go dark and curse all the Duchannes family's women. They consult with Amma, who is in a seer/keeper of a caster library beneath the town library. The most ancient of these books, the Book of Moons, reveals the secret to undoing the curse: one of Lena's loved ones has to die. Unwilling to take Ethan's life, Lena instead erases his memories of their time together.
Ridley seduces Link and gives him a bullet to use in an upcoming Civil War reenactment of the Battle of Honey Hill which will take place on Lena's birthday. During the reenactment, Link and Ethan agree to "kill" each-other so they can ditch the reenactment. While at the ceremony for her 16th birthday, Lena feels the shock of the curse being broken and runs off to Ethan, clutching his dying body as Ridley and Sarafine encourage her to surrender to grief and accept the dark. Lena lashes out in anger, sending lightning strikes through the crowd of reenactors until Ethan transforms into Macon, who had previously disguised himself as Ethan to become the needed sacrifice. His dying words encourage Lena to "claim yourself"; she then causes the moon to disappear so it cannot claim her for the dark. Lena allows Ridley to flee and pulls Sarafine from Mrs. Lincoln's body, using her power to seal Sarafine's spirit away.
Months later, a still-amnesiac Ethan stops by the library to visit Amma before leaving for a college campus tour with Link. He apologizes to Lena for not having got to know her during their time in Gatlin. Lena is then seen in the caster library, where it is revealed that she has claimed herself as a half dark/light caster. Meanwhile, just after Link drives past the town line, Ethan recalls their memories together. He gets out of the car to call Lena's name. Lena hears and the movie ends.