In an anteroom outside of the king’s bedroom, Oscar, the royal page, announces Gustavus and asks the king’s approval of the invitations for a masked ball. Seeing the name of Amelia, wife of his chief minister Anckarström, the king, who is romantically attracted to her, briefly loses himself in thought of a future meeting. As the others leave, Oscar admits Anckarström, who says he knows the cause of the king’s distressed look: a conspiracy against the crown. The minister of justice arrives with a decree banishing the fortuneteller, Madame Arvidson (known as Ulrica), who has been accused of witchcraft. Deciding to see for himself and overruling Anckarström’s objections, the king bids the court to join him in an incognito visit to the soothsayer.
After invoking the dark spirits, Ulrica, a fraudulent mystic, tells the sailor Christian that he will prosper. Gustavus, disguised as a fisherman, surreptitiously slips money and a promotion into Christian’s belongings. When he finds it, all are suitably impressed. The king stays in hiding when Ulrica sends her visitors away to grant an audience to Amelia. Ulrica instructs Amelia to find a magic herb that grows at the foot of the gallows outside the city gates. Amelia undertakes to do so that very night, and Gustavus resolves to follow her there. The king, still incognito, asks Ulrica to read his palm. She divines that he will die by the next hand he shakes, and he invites anyone in the company to disprove her prophecy. When they refuse to do so, he clasps the hand of Anckarström, who has just arrived.
A frightened Amelia arrives at the gallows as midnight strikes. Gustavus appears and declares his love for her. She admits her own love for him, but begs him to think of her honor. Anckarström rushes in to warn the king to flee the approaching assassins. Gustavus asks Anckarström to escort the veiled lady back to the city gates without attempting to discover her identity. Finding Anckarström instead of their intended victim, the assassins curse their luck. Anckarström draws his sword against them, and as Amelia rushes to defend her husband, her veil falls back, revealing her identity. The conspirators make fun of Anckarström’s discomfort and, as the conspirators leave, he coldly reminds his wife that he has sworn to escort her to the gates of the city.
Upon returning to their home, Anckarström explodes in anger and declares that death is the only possible punishment for her betrayal, but accedes to her request for a last meeting with her son. When Ribbing and Horn arrive, Anckarström asks to join the conspiracy. They are at first suspicious but become convinced when he offers his own son as hostage. United in purpose, they cannot agree on who should have the privilege of assassinating the king. Amelia returns just as the men are about to draw lots. Seeing the irony in Amelia choosing her lover’s assassin, Anckarström forces his wife to draw a name from the urn and rejoices when his is chosen.
Alone in his room, Gustavus struggles with the decision to sacrifice his love for Amelia. He resolves to send Amelia away with Anckarström on a diplomatic appointment abroad. Oscar delivers a note to the king from an unknown lady, warning him of a murder plot. He decides to ignore it, not wanting his absence to be taken as a sign of cowardice.
In the confusion of the masked ball, Anckarström informs Ribbing and Horn that the king will not be present. Oscar lets slip the news that the king is present after all, and when Anckarström insists that he must speak to the king on urgent state business, Oscar reveals Gustavus’s disguise. Amelia urges him to leave as his life is in danger. He refuses but tells her of the foreign assignment for her husband, and bids her an ardent farewell. Anckarström discovers them and shoots the king. The dying Gustavus, surrounded by his grieving court, forgives Anckarström, who learns too late of his wife’s innocence.