Cesare Angelotti, a political prisoner and former leader of the Napoleon resistance, has just escaped from the prison at Castel Sant’Angelo and is seeking refuge in a nearby church. As Angelotti hides in his family’s chapel, a sacristan enters followed by the painter Mario Cavaradossi, who begins to work on a portrait of Mary Magdalene. Angelotti comes out of hiding and asks for his friend Cavaradossi’s assistance but hides again as the voice of the painter’s lover, the famous opera singer Floria Tosca, is heard. She enters demanding to know why the door to the church was locked and suspects Cavaradossi of being with another woman. He reassures her of his fidelity, and the lovers agree to meet later that evening.
A cannon shot is heard announcing Angelotti’s escape, and the friends flee. The sacristan gathers the choir boys, telling them they must rehearse for a special performance for which Tosca will be the soloist celebrating Napoleon’s defeat. At that moment, the Roman chief of police, Baron Scarpia, arrives searching for Angelotti. Scarpia, suspecting Cavaradossi’s complicity in Angelotti’s escape, convinces Tosca that Cavaradossi has run off with another woman. Scarpia knows that Tosca’s jealousy will lead him to Cavaradossi, and thus to Angelotti. As the Te Deum hymn builds in intensity, he vows to ensnare them all.
Having detained the Marchesa Attavanti for aiding her brother’s escape, Scarpia receives word of Cavaradossi’s arrest. He summons Tosca from her concert in the courtyard below, and she is shocked to see the captured Cavaradossi. Scarpia tries to extract Angelotti’s hiding place from Tosca, but she pleads ignorance. Yet as Scarpia raises the stakes, torturing Cavaradossi, she capitulates, revealing the secret and asking Scarpia for Cavaradossi’s freedom in return. Delirious from torture, Cavaradossi hears Scarpia order his men to Angelotti’s hiding place, curses Tosca, and cries defiance as news emerges that Napoleon was actually victorious.
Tosca pleads for her lover’s life, and Scarpia offers her an exchange: if she will submit to his lust, he will save Cavaradossi’s life. In despair, she pleads for mercy but realizes she must agree to the bargain. Scarpia tells Tosca there will be a mock execution, but circuitously orders his henchman to make preparations for a real one. At Tosca’s request, he then writes a safe-conduct pass for her and Cavaradossi. Tosca, having discovered a dagger among the tributes and bribes that Scarpia has received, stabs him, takes the safe-conduct pass and goes to find Cavaradossi.
Waiting for his execution, Cavaradossi bribes the jailer so that he can write a farewell letter to Tosca, recalling the intensity of their love and mourning that he will never see her again. Tosca runs in, explaining that she has murdered Scarpia but they will escape—the execution will be faked and with their safe-conduct pass they can flee together. The lovers ecstatically plan for the future but are interrupted by the arrival of the firing squad. After the shots, Tosca bids Cavaradossi to wait until the soldiers are gone and then asks him to escape with her. She is horrified to discover that the execution was real after all, and distant shouts announce Scarpia’s murder. As the soldiers rush in to seize Tosca, she curses Scarpia’s betrayal, climbs to the fortress parapet, and leaps to her death.