Year of Wonders opens in the autumn of 1666. The protagonist, Anna Frith, watches the half-hearted harvesting process as farmers bring bruised apples to the rectory. Anna is the housekeeper to the vicar Michael Mompellion. She reflects that while autumn used to bring successful harvests and security for the winter, now it only reminds her how much the village has lost the rhythm of its ordinary life. While she doesn’t mention the plague by name, she hints at the nature of the disaster that has decimated the population, threatened her own sanity, and catalyzed a breakdown in Mompellion, towards whom she is fiercely loyal and protective. Elizabeth Bradford arrives at the rectory and haughtily demands that Anna and Mompellion come to the aid of her mother, who is suffering from a “tumor.” They are incensed by her behavior, given that her family fled the plague with no regard for the fate of the town, and they refuse to help. Mompellion suggests ironically that Elizabeth pray for divine assistance but says that she will find God a “poor listener.” Then he deliberately drops a Bible on the floor, shocking Anna with his blasphemous behavior.
The narrative goes back in time a year and a half, to the spring of 1665. With finances tight after the recent death of her husband in a mining accident, Anna takes in the apprentice tailor, George Viccars, as a boarder. George turns out to be kind and interesting, entertaining Anna with tales of faraway London and playing with her sons, Jamie and Tom. Eventually, he proposes marriage to Anna, and she considers accepting, but before she can make a decision, he falls ill with a mysterious and powerful fever that kills him in just a few days. Suspecting he has contracted the plague from bolts of cloth shipped from London, George exhorts Anna to burn the cloth and all his possession. But the villagers refuse to part with the clothes they have commissioned from George, ensuring that the plague quickly spreads throughout the town. Meanwhile, while serving a dinner at Bradford Hall, Anna hears a visitor from London callously describing a deadly outbreak of the plague in London.
After a few weeks of calm, the children of Anna’s neighbors, the Hadfields, catch the plague and die, quickly followed by Jamie and Tom. Devastated by their loss, Anna stumbles through her daily tasks, oblivious to the fact that the plague is spreading throughout the town. One night, chasing after a lost sheep, she comes across a mob of villagers assaulting Mem Gowdie, whom they are convinced is a witch responsible for the plague. Anna tries to defend Mem, but can’t prevent the mob from “dunking” her in the lake, a superstitious practice used to determine whether a woman was a witch. Anys, Mem’s niece, arrives and saves her from drowning, but the hysterical mob turns on her and hangs her. Mompellion arrives and excoriates the mob for their wrongdoing, but the damage is done: Mem and Anys, the only citizens with any medical knowledge, are dead.
As more people catch the disease, Mompellion worries that it will spread to other villages and become a regional or even national epidemic. In a moving and charismatic sermon, he convinces the villagers to voluntarily quarantine themselves until the plague has run its course, telling them that the catastrophe is a test from God. The only people who don’t agree are the Bradfords, who use their resources and position to flee Eyam.
As the vicar’s wife, it is Elinor Mompellion’s job to tend to sick parishioners, and as the plague spreads and this task grows more draining, she makes Anna her assistant. With little experience in childbirth, Anna delivers Mary Daniel’s baby, after which she becomes the town midwife and nurse. However, almost everyone who catches the plague dies, and Anna and Elinor can do little besides try to ease their pain.
Overtaxed by panic and grief, the villagers become irrational. Anna discovers that some people are buying charms from someone claiming to be Anys’s ghost. Meanwhile, Anna herself takes dangerous doses of poppy oil (an opiate) to numb the pain of losing her sons. She returns with Elinor to Anys and Mem’s garden with the hope of rediscovering some of their herb knowledge in order to treat the plague more effectively. As their friendship deepens, Elinor confesses to Anna that, as a teenager, she had a premarital affair that resulted in an illegitimate pregnancy, which she ended with a self-induced abortion. As a result, she is now unable to have children. Only her husband knows the full story of her transgressions, and she finds it very gracious of him to have married her despite what others would surely see as a sordid history.
Meanwhile, the town sexton dies, over-exhausted from digging too many graves. Anna convinces her father, Josiah (or Joss), to become the new grave-digger. However, he charges his desperate neighbors exorbitant fees to bury the dead, and sometimes takes advantage of the chaos to steal household goods. Eventually, he attempts to bury the plague-stricken (but relatively healthy) Christopher Unwin alive in order to rob his house. The miner’s association (Eyam’s only formal government organization) tries him for theft and sentences him to be impaled by the hands to Unwin’s mine. This is a harsh but customary punishment, and it’s expected that after a few hours of pain someone from the criminal’s family will come to remove the knife. However, Josiah’s wife Aphra is too busy nursing her sick children to fetch him or send for help. Josiah dies a horrible death of exposure to the elements. Aphra blames Anna for her husband’s death and makes Anna accompany her to reclaim his disfigured body.
Anna notes that more than half of Eyam’s population has died, and community life has all but fractured. Many tasks and trades are unattended, and people avoid meeting in public because of contagion. More and more villagers are buying fake charms from the mysterious “ghost,” and John and Urith Gordon begin flagellating themselves in order to allay God’s wrath. Mompellion acts quickly to stop the Gordons from spreading what he sees as fringe extremism to the rest of the villagers, even as he himself fiercely castigates a young woman named Jane Martin for assuaging her grief by drinking and “fornicating,” calling her a whore and a “sinner” against God.
Mompellion decides that the town needs to burn most of their material goods, in order to make a sacrifice to God and to remove sources of contagion from their midst. While everyone is assembled for the bonfire, Brand Rigney and Robert Snee arrive with Aphra, whom they have discovered selling the fake charms. Everyone is enraged at her for taking advantage of their panic, and agree to try her formally the next day. However Brand and Robert throw her in a sewer pit overnight and she goes completely insane from the ordeal, after which it seems pointless to hold a trial. Aphra’s one remaining child, Faith, dies of the plague and Aphra, having lost her mind, refuses to surrender the body for burial.
New cases of plague cease to appear, and at his wife’s urging Mompellion holds a Thanksgiving service one Sunday. While everyone is assembled in a field, praying for deliverance, a completely deranged Aphra appears wielding a knife and carrying her daughter’s decaying corpse. When Mompellion and Elinor try to comfort her, she cuts Elinor’s throat, killing her.
The narrative skips forward to autumn, where the prologue left off. As a result of his wife’s death, Mompellion has lost his faith in God and, seemingly, his will to live. Anna tries to distract herself from her own grief by taking care of him. Eventually, both of them lonely and seeking comfort, they have sex. However, afterwards he confesses that, in order to make Elinor atone for the “sins” of premarital sex and abortion, he refused to have sex with her throughout their marriage. Anna thinks that this behavior is insane and deeply unkind to Elinor, prolonging her undue feelings guilt and regret.
Running out of the rectory, Anna runs into Elizabeth Bradford, who confesses that her mother doesn’t have a tumor but is actually about to give birth to an illegitimate child and is in danger of dying. Anna goes to Bradford Hall and successfully delivers the child, saving its life along with Anne Bradford’s. Elizabeth tries to kill the baby to hide the family shame of a child conceived out of wedlock, but Anna stops her and agrees to leave town with the baby and conceal its origins. Before she leaves Eyam she meets Mompellion, who pleads unsuccessfully for forgiveness but gives her his horse to aid her getaway.
In the epilogue, Anna has settled in the Muslim city of Oran, Algeria. She locates a famous doctor, Ahmed Bey, and convinces him to take her on as an apprentice and (in name only, so that she can live with him) his wife. Since the Arab world is more scientifically and medically advanced than English society, Anna becomes a trained midwife and gains a medical education, as well as personal autonomy and a sense of purpose to replace her lost faith in God. She names Anne Bradford’s baby Aisha, the Arabic word for “life,” and raises her alongside her own biological daughter, a child conceived with Mompellion whom she names Elinor, in memory of her friend.