While visiting Alicante in Spain, Alsemero, a wealthy young Spaniard, falls in love with noblewoman Beatrice-Joanna. When he discovers that she is betrothed to another man, Alonzo, at her father Vermandero's urging, he decides to extend his stay in hopes of winning her over. Meanwhile, Alsemero's friend Jasperino flirts with Beatrice-Joanna's lady-in-waiting, Diaphanta.
Vermandero invites Alsemero to his house to exude proper etiquette. There, Vermandero's servant DeFlores arrives. Beatrice-Joanna is cruel to DeFlores and tells Alsemero that she detests him for his ugly appearance and weak demeanor. DeFlores reveals to the audience that he is secretly in love with Beatrice-Joanna.
Meanwhile, at a madhouse across town, the doctor Alibius is worried that someone will try to steal his young wife, Isabella. He orders his assistant Lollio to lock Isabella away.
Alonzo arrives for his wedding with his brother, Tomazo, who recognizes that Beatrice-Joanna does not seem interested in the impending marriage. Beatrice-Joanna decides to manipulate DeFlores into killing Alonzo by flirting with him. DeFlores agrees, and under the pretense of touring the castle, DeFlores stabs Alonzo to death. He cuts off one of Alonzo's fingers on which he wore a diamond ring, hoping to give it to Beatrice-Joanna.
At the madhouse, Isabella is courted by a patient, Antonio, who reveals that he is not a fool as everyone thinks but is only pretending to be one to get close to her. Lollio witnesses Antonio's attempted seduction of Isabella and sends him away, but forces himself on Isabella. Alibius returns just in time, announcing to Lollio that the madmen are expected to dance at the upcoming wedding at the castle.
DeFlores presents Beatrice-Joanna with the ring, and she tells him to keep it as part of his payment. DeFlores tells Beatrice that he would never kill just for money, and that he instead wants to be the person to whom she loses her virginity. Eventually, Beatrice-Joanna realizes how she has unwittingly linked herself to DeFlores forever, and she agrees to sleep with him. Vermandero learns that Alonzo is dead, and agrees to let Beatrice-Joanna marry Alsemero.
However, Beatrice-Joanna discovers that Alsemero plans to use a potion on her to determine if she is really a virgin. She resolves to send Diaphanta to Alsemero disguised as herself, and tests the potion on Diaphanta with success.
While Tomazo searches for his brother's killer, Alsemero becomes jealous when he hears from Jasperino that Beatrice-Joanna was flirting with DeFlores. He tests the potion on Beatrice-Joanna, who mimics Diaphanta's reaction of sneezing and laughing, which reveals to Alsemero that Beatrice-Joanna is a virgin.
At the madhouse, another patient, Franciscus, attempts to seduce Isabella by telling her that he, too, is only pretending to be mad. Isabella, frustrated with this behavior, disguises herself as a madwoman to test Antonio's affection for her. When he rejects her, she proves that he never really loved her. Meanwhile, Lollio schemes to make Franciscus and Antonio enemies.
While Diaphanta is with Alsemero, DeFlores offers to start a fire in the castle to ease Beatrice-Joanna's anxiety and force Diaphanta and Alsemero to separate. Beatrice-Joanna realizes that she is attracted to DeFlores in earnest. After starting the fire, DeFlores shoots Diaphanta.
Alsemero, still not trusting of Beatrice-Joanna, pressures her until she confesses to her crimes and implicates DeFlores. Alsemero locks them away. When the other characters arrive, Alsemero reveals Beatrice-Joanna's and DeFlores's guilt. DeFlores kills himself, satisfied that he was able to have sex with Beatrice-Joanna. Beatrice-Joanna also takes her own life, fearing the punishment that awaits her.
Vermandero blames himself for not having thought his daughter and DeFlores capable of such treachery. Isabella, gesturing toward the scandal at the castle, asks her husband to trust her more. In the epilogue, Alsemero delivers a speech about the importance of forgiveness.