Cesare Angelotti, a political prisoner, has just escaped from the jail at Castel Sant'Angelo. He seeks refuge in the Attavanti chapel of the church of Sant'Andrea della Valle and hides at the approach of the Sacristan who is soon followed by the painter Mario Cavaradossi. The Sacristan recites the Angelus while Cavaradossi climbs the scaffold and begins to work on his painting, pausing to admit that his portrait of Mary Magdalene was first inspired not only by an unknown lady who came to pray to the Virgin, but also by his beloved Floria Tosca, a famous opera singer. The scandalized Sacristan leaves. Angelotti comes out of hiding and asks for Cavaradossi's assistance. The painter, thrusting a lunch basket into his hands, urges Angelotti back into the chapel as the voice of Tosca is heard. He hides as Cavaradossi admits Tosca into the church. She demands to know why she was kept waiting, and suspects Cavaradossi of talking to another woman. He reassures her of his love, and the pair agrees to meet that evening at Cavaradossi's villa. With Tosca gone, Angelotti reappears and Cavaradossi vows to save him. A cannon shot is heard announcing that the prisoner’s escape has been discovered. Cavaradossi leaves with the pursued man in order to hide him at his villa. The Sacristan returns and gathers choristers around him, telling them they must rehearse for a special performance of a cantata that evening celebrating a defeat of Napoleon; Tosca will be the soloist. At that moment, the Roman chief of police, Baron Scarpia, arrives searching for Angelotti. His men find the Attavanti chapel open, but all that remains is a fan with the family crest on it and the empty lunch basket. The Sacristan expresses amazement, as earlier he had noticed that the painter had not touched his meal. Scarpia puts two and two together and realizes that Cavaradossi had aided Angelotti's escape. Suddenly Tosca returns and Scarpia uses the fan to convince her that Cavaradossi has fled with another woman, thus awakening jealousy in her. He hopes Tosca will then lead him to Cavaradossi and thus to Angelotti. He orders his spies to follow her as she leaves the church, then joins in the Te Deum, swearing he will capture not only the painter, but Tosca as well.
Scarpia is dining alone in his quarters in the Farnese Palace, anticipating the pleasure of bending Tosca to his will. His henchman Spoletta appears and reports that Tosca has led Scarpia's spies to a remote villa, and though Angelotti was not to be found, they arrested Cavaradossi. The painter is brought in as Tosca's voice is heard from the concert in the courtyard below. Scarpia summons Tosca and she is shocked to see Cavaradossi who quietly warns her to reveal nothing about Angelotti. Scarpia tries to get the location of Angelotti's hiding place from her, but she insists that she knows nothing. As Cavaradossi is tortured in the next room, she reveals the secret and asks Scarpia for Cavaradossi's freedom in return. Scarpia has Cavaradossi brought back in. Delirious from torture, Cavaradossi hears Scarpia order his men to the villa, curses Tosca, and cries defiance at the tyranny of Scarpia and the foreign oppressors he represents. Word arrives that the earlier report of Napoleon's defeat at Marengo was incorrect. Instead, Napoleon was the victor. Cavaradossi cries out with joy and is dragged from the room to prison. Tosca pleads for her lover's life, and Scarpia offers her an exchange: if she will give herself to him, he will give Cavaradossi back to her. In despair she pleads for mercy, protesting that she has never done anything to deserve being faced with such a terrible choice, but realizes she must agree to the bargain. Scarpia tells Tosca there must be a mock execution and circuitously orders Spoletta to make preparations for a real one. At Tosca’s request, he then writes a safe-conduct pass for her and Cavaradossi and prepares to claim his prize. She grabs a knife from the table and stabs him, then takes the pass and goes to find Cavaradossi.
On the terrace of Castel Sant'Angelo, outside the prison, the voice of a shepherd is heard at dawn while one by one the bells of Rome strike the hour. Cavaradossi is brought in for his execution, which is an hour away. He bribes the jailer with a gold ring for permission to write a farewell letter to Tosca. Left alone, he recalls pleasant memories of times they spent together. She suddenly hurries in, explaining that there is to be a mock execution in which he is to pretend to die. She also tells him about Scarpia's murder and of the safe-conduct pass that will get them out of Rome before the murder is discovered. He can hardly believe the news and looks in wonder at the delicate hands that did so much to save him. The lovers ecstatically plan for the future but are interrupted by the arrival of the soldiers. As the firing squad advances and takes aim, Tosca urges Cavaradossi to fall convincingly. The soldiers fire and Cavaradossi falls. Tosca bids him to wait until they are gone and then asks him to rise and come away with her. She hurries to Cavaradossi and is horrified to discover that the execution was real after all. Distant shouts announce that Scarpia's murder was discovered. As Spoletta, Sciarrone, and the soldiers rush in to seize Tosca, she climbs to the fortress parapet and leaps to her death.