Mary Shelley conceived this story in 1816, while staying on Lake Geneva as the guest of Byron. According to her introduction to the novel, their host challenged his guests to write a ghost story, and Frankenstein was the product of its author's unusually vivid nightmare. In combining Gothic terrors with extreme physical realism and a basis in the sciences of biology and electricity, Shelley founded the genre of science fiction. The novel is the story of Victor Frankenstein, a medical student who constructs a living being from the remains of dissecting-room corpses. Victor's experiments dramatize the morality of the act of creation itself. He explains: “I collected bones from charnel- houses; and disturbed, with profane fingers, the tremendous secrets of the human frame.” Horrified by the result of his project, Frankenstein abandons the Creature, who wanders the countryside, tormented by his total isolation from humanity. The Creature persuades his creator to construct a second, female being, but Victor dismembers this before it can be brought to life. In revenge, the Creature murders Frankenstein's bride. A chase across the world then ensues, Victor determining “to pursue the dæmon who caused this misery until he or I shall perish in mortal conflict”. The Creature, despite his monstrosity, is an intensely tragic figure, and Shelley effects an uncanny merging of its personality with that of Victor, who considers it “my own vampire, my own spirit let loose from the grave”. A critical and popular success, the book was dedicated to William Godwin.
After her husband's death in 1822, Shelley returned to England, where she settled with her son. She was granted a small allowance by her father-in-law, Sir Timothy Shelley, but this was temporarily withdrawn when she published Percy Bysshe Shelley's Posthumous Poems (1824). She spent much time editing and annotating her late husband's work, but, owing to Sir Timothy's opposition, she was unable to publish the Poetical Works until 1839.
Shelley published five other novels. Valperga (1823) is a romance of 14th-century Italy. The Last Man (1826) is an apocalyptic fantasy in which humanity is destroyed by plague. Set in a republican Britain of the year 2073, it traces the effects of global catastrophe on a small group of characters and their wider environment. The final section of the book sees its narrator, Lionel Verney, living in the ruins of a decimated Rome. The Fortunes of Perkin Warbeck (1830) is a historical drama much influenced by the novels of Sir Walter Scott. Lodore (1835) and Falkner (1837) are domestic stories with strongly autobiographical elements. Another novel, Mathilda (1819), which tells the story of an incestuous relationship between a father and daughter, remained unpublished until 1959.
Financing her son's private education, Mary Shelley continued to write essays and short fiction for periodicals such as the Keepsake. Between 1835 and 1838 she produced a series of scholarly biographies for the Lardner's Cabinet Cyclopædia series. The death of Sir Timothy Shelley in 1844 brought a new-found security to her life, but her closing years were troubled by threats of blackmail from embittered members of the Shelley and Byron families.