A young prince named Tamino is being chased by a serpent through a valley. After he falls unconscious, three ladies enter and kill the snake. Tamino awakens and assumes the snake was killed by a good-natured bird catcher named Papageno who has just arrived on the scene. When Papageno accepts the credit, the three ladies reappear and place a padlock on his lips to prevent further lying. They show Tamino a portrait of Pamina, the beautiful daughter of their mistress, the Queen of the Night. He immediately falls in love with her. They tell him she has been kidnapped by the evil magician Sarastro. The Queen appears and asks Tamino to rescue Pamina, which he agrees to do. The ladies free Papageno and give him a magic set of chimes. They also give Tamino a magic flute and send the two off on their mission. Pamina is being guarded by a villain named Monostatos, who is attempting to seduce her when Papageno wanders in. Frightened, Monostatos runs off, leaving Papageno to tell Pamina that her rescuer is close by.
Tamino is being led through Sarastro’s realm by three boys. He tries to enter the three temple doors, but is turned away from two. At the third, he is greeted by a priest, who tells him the Queen is really the evil one and the good Sarastro was merely trying to get Pamina away from her mother’s dark influence. Tamino rushes off to find Pamina; a moment later, she and Papageno enter, pursued by Monostatos. Papageno plays his magic bells, rendering the villain and his henchmen harmless. Sarastro enters and tells Pamina she is free to marry but not to return to her mother. Tamino is brought in by Monostatos, who demands a reward from Sarastro but instead gets punished.
Sarastro informs the priests that Tamino and Papageno are about to undergo the rites of initiation to determine if they are worthy to enter Sarastro’s Temple of Light. Tamino, who is brave, and Papageno, who is not, receive contradictory counsel from the temple priests and the Queen of the Night’s three ladies, but they decide to follow the priests, who take away the flute and bells from the pair. Monostatos attempts one last seduction of Pamina, but he is interrupted by the Queen who comes to her daughter and demands that she murder Sarastro. Instead, Pamina goes to Sarastro and begs forgiveness for her mother; he agrees, declaring that only love, not vengeance, will lead to peace and happiness.
As part of their tests, both Tamino and Papageno are sworn to silence. An old woman approaches Papageno declaring that she is really eighteen years old and in love with him. She runs away, but three boys appear and give back to Tamino and Papageno the magic flute and bells. Pamina arrives, but she misunderstands Tamino’s silence and is heartbroken. Sarastro reassures her, but she is not comforted. Papageno says that he wants a sweetheart, and the old woman returns and reveals herself to be a young woman in disguise. Her name: Papagena. As soon as she reveals herself, however, a priest orders her away.
Meanwhile, Pamina is about to commit suicide using the dagger her mother gave her to kill Sarastro. The three boys stop her and take her to Tamino, who is about to undergo the final two trials. Pamina and Tamino go through the ordeals together, emerging unscathed thanks to the magic flute. Papageno rather reluctantly attempts to hang himself. Seeing this, the three boys suggest he play his magic bells. He does and Papagena appears; the two declare their intent to raise a large family. Meanwhile, Monostatos has joined forces with the Queen of the Night, but their plan to kill Sarastro is foiled by an earthquake. The opera ends with Sarastro, Tamino, and Pamina celebrating the victory of light over darkness.