Li Lan is a young woman living in Malaya in the late 1880s with her father and her nurse Amah when her family receives the offer for her to become a ghost bride to their deceased son, Lim Tian Ching. Horrified, Li Lan and her father refuse but soon find themselves entangled with the Lim family. Things become even more complicated when Lim Tian Ching begins to haunt Li Lan in her dreams, trying to convince her to become his bride even as Li Lan finds herself attracted to his cousin, Tian Bai. The haunting grows worse and when Li Lan finally gets the courage to tell Amah what has been happening, they consult a medium to try and ward off the spirit of Lim Tian Ching. While this works for a short time, Li Lan still finds herself having marriage issues, learning that the Lim family has control over her and her father through her father's unpaid debts and that although Tian Bai was actually originally promised to marry her, he is now betrothed to a daughter of a more prosperous family. In addition, Lim Tian Ching makes his way back into her dreams, telling her that Tian Bai murdered him by poisoning his tea.
Overwhelmed, Li Lan overdoses on medicine given to her by the medium, and accidentally separates her spirit from her body. While wandering around the spirit world in pursuit of a thread she saw leading out of her window, Li Lan makes her way to the Lim household and notices that Yan Hong has hidden the teacup in the closet, which makes her suspicious. She then flees from the Lim household and ends up encountering a ghost in the form of a young woman named Fan, who tells her that she is waiting for her lover to die so that they can be reunited. She believes Li Lan to be a fairy from heaven, as she can tell that Li Lan is alive, but Li Lan does not correct her, instead asking her how she can get to the Plains of the Dead so she can try and see her mother. Fan gives her instructions to get a conveyance and offers to help for a price. Li Lan then uses the thread she found (which connects to Tian Bai) to visit him in his dreams and ask him to draw a picture of her horse and burn it, although she does not tell him what it's for. After visiting Tian Bai, Li Lan sees a man that seems familiar to her and follows him on impulse, overhearing a conversation between him and a demon. The man reveals that he heard her and introduces himself as Er Lang. Informing Li Lan that he is a minor official, he asks her to spy on the Lim family for him to prevent war from occurring in the afterlife. Li Lan agrees and spends the night on the hillside; when she wakes up, she finds a horse waiting for her and immediately goes to Fan so they can go to the Plains of the Dead.
They arrive at the doorway, which seems dark to Li Lan, but Fan guides her through anyways. After they arrive at the Plains, Li Lan and Fan split ways and promise to meet up after ten days. Li Lan then wanders around, soon encountering an old man who tells her that the layout of the Malacca of the Plains of the Dead is similar to the layout of the living Malacca. Using that information, she finds her way to their house. Upon knocking on the door, an older woman answers it. This woman reveals that she is Li Lan's grandfather's third concubine and that after her death, she sold part of her soul to send smallpox to Li Lan's house, killing her mother, who she says is now at the Lim mansion. Going to the Lim mansion disguised as a servant, Li Lan undergoes multiple challenges as she is discovered as a spy by the Lim family and learns more about the conspiracy that centers around the Lim family. With the help of Er Lang and the Lim family's cook's assistant, Auntie Three (who she discovers is her mother), she manages to escape both the house and the Plains of the Dead, with Er Lang sacrificing himself to their pursuers. But at the last moment, Fan betrays Li Lan by using the darkness of the tunnel to trick Li Lan into exiting the Plains through the wrong door.
Li Lan initially panics but eventually figures out how to get back home, although the journey is difficult and weakens her spirit. When she manages to return to Malacca, she realizes that Fan has stolen her body and is trying to pass herself off as the real Li Lan. This makes Li Lan feel hopeless, driving her to go see the medium. On her way, she impulsively calls for Er Lang, who comes to her, as it turns out that he is not dead. She, however, is dying, and he gives her some of his breath to give her strength through a kiss. With her newfound strength, Li Lan goes back to her home to find Amah attempting to exorcise Fan when an ox demon enters the home, looking for Li Lan. As Fan tries to defend herself, Amah uses the distraction to exorcise her, giving Li Lan the opportunity to return back to her body.
Now, even though everything is back to normal, Li Lan still feels restless. One day, when visiting Yan Hong, Madame Lim overhears Yan Hong imply to Li Lan that she was the one responsible for Lim Tian Ching's death, causing her to push them into the nearby well. Li Lan helps Yan Hong escape but slips herself in the process. Desperate and worried that Yan Hong will not return in time, Li Lan calls out to Er Lang for help, who answers. After he rescues her from the well, he admits that her taking so much of his breath changed her and that she will not age normally. He gives her the option to live with Tian Bai for fifty years and then come to him, or come to him immediately. Li Lan is given a fortnight to think this over, and the novel ends in the present tense with Li Lan committing to go with Er Lang instead of marrying Tian Bai.