Both supporters and opponents of King Gustavo (Gustav III) of Sweden are gathering for the morning royal audience. Oscar, the king's page, hands over to his master a paper listing the guests for a masked ball. Gustavo discovers that the list includes Amelia, the woman with whom he is secretly love, even though she is the wife of his loyal old friend, Renato, the count of Anckarström. When Renato enters, Gustavo suddenly gets the feeling that his secret has been discovered, but Renato has no inkling of his lord's feelings. He has come in order to warn the king that there is a conspiracy afoot against him. Gustavo is so relieved that he does not even want to know who the conspirators are. The chief judge hands the king a writ calling for the banishment of the fortune-teller Ulrica Arvedon. After Oscar comes to the woman's defence, Gustavo decides to pay a visit to Ulrica in disguise.
Surrounded by women, Ulrica invokes Lucifer; Gustavo, dressed as a fisherman, blends into the audience. A sailor named Christiano pushes his way to the front of the crowd to have Ulrica tell his future: after 15 years, he has not received the recognition he deserves. Ulrica reads Christiano's palm and finds that he will soon be promoted and become rich. Gustavo secretly places a few gold coins and a letter of promotion into the sailor's pocket. Ulrica's prophecy has immediately proved accurate.
Through her servant, Amelia asks Ulrica for a private consultation. The seer sends off her visitors; only Gustavo, having hidden himself, is left to listen in as Ulrica speaks with the despairing woman. Amelia wants the seer to use her magical powers to help her overcome her love for the king. The magic substance that Ulrica recommends is a plant that grows in an abandoned field outside the city, and which must be picked at midnight.
After Amelia departs, Gustavo also wishes to hear his fortune. Ulrica foresees his impending death: whichever friend of his extends his hand to him first will turn out to be his murderer. When the completely unsuspecting Renato enters and greets his lord with a handshake before addressing him by name, nobody believes that Ulrica's prediction will come true. With Gustavo's true identity now revealed, Christiano gathers the people together to greet their king with proper respect.
After conquering her fear, Amelia arrives at the field. Gustavo has followed her in secret, and he two now confess their love for each other. Suddenly Renato arrives to warn his friend that his life is in danger. Gustavo asks him to accompany the veiled - and thus unrecognised by her husband - Amelia back to the city.
The conspirators intercept Renato and provoke him into drawing his sword. Amelia's veil falls off, revealing her identity. In his deep distress, Renato decides to exact vengeance on the king and asks the conspirators to his house the next day.
Believing that Gustavo and Amelia have betrayed him and deaf to his wife's attempt to convince him of her innocence, Renato resolves to kill her. Amelia prepares to die, but first asks her husband to let her see their son one last time. Renato realises that it is really Gustavo on whom he must take revenge.
The conspirators - the counts Horn and Ribbing - arrive at Renato's house, where their host informs them that he too wishes to join them. However, as each of them would like to be the one to deliver the fatal stab, Renato asks te unsuspecting Amelia to draw the name of the murderer from a pot - and he himself is the one selected. Oscar arrives to deliver the invitations to the masked ball. The conspirators decide to carry out their plan during the festivities.
Gustavo decides to give up on his love for Amelia. Oscar hands the king an anonymus letter warning him that somebody intends to kill him during the ball. Gustavo resolves to attend the ball anyway, so that nobody can accuse him of cowardice.
At the masked ball, Renato elicits from Oscar what costume the king will be wearing. The amorous couple say farewell to each other. Anckarström kills the king. With his last remaining strength, Gustavo assures his friend of his wife's innocence and forgives his enemies