Cesare Angelotti, former consul of the Roman Republic and now an escaped political prisoner, runs into the church and hides in the Attavanti private chapel – his sister, the Marchesa Attavanti, has left a key to the chapel hidden at the feet of the statue of the Madonna. The elderly Sacristan enters and begins cleaning. The Sacristan kneels in prayer as the Angelus sounds. The painter Mario Cavaradossi arrives to continue work on his picture of Mary Magdalene. The Sacristan identifies a likeness between the portrait and a blonde-haired woman who has been visiting the church recently (unknown to him, it is Angelotti's sister the Marchesa). Cavaradossi describes the "hidden harmony" ("Recondita armonia") in the contrast between the blonde beauty of his painting and his dark-haired lover, the singer Floria Tosca. The Sacristan mumbles his disapproval before leaving.
Angelotti emerges and tells Cavaradossi, an old friend who has republican sympathies, that he is being pursued by the Chief of Police, Baron Scarpia. Cavaradossi promises to assist him after nightfall. Tosca's voice is heard, calling to Cavaradossi. Cavaradossi gives Angelotti his basket of food and Angelotti hurriedly returns to his hiding place. Tosca enters and suspiciously asks Cavaradossi what he has been doing – she thinks that he has been talking to another woman. Cavaradossi reassures her and Tosca tries to persuade him to take her to his villa that evening: "Non la sospiri, la nostra casetta" ("Do you not long for our little cottage"). She then expresses jealousy over the woman in the painting, whom she recognises as the Marchesa Attavanti. Cavaradossi explains the likeness; he has merely observed the Marchesa at prayer in the church. He reassures Tosca of his fidelity and asks her what eyes could be more beautiful than her own: "Qual'occhio al mondo" ("What eyes in the world"). After Tosca has left, Angelotti reappears and discusses with the painter his plan to flee disguised as a woman, using clothes left in the chapel by his sister. Cavaradossi gives Angelotti a key to his villa, suggesting that he hide in a disused well in the garden.
The sound of a cannon signals that Angelotti's escape has been discovered. He and Cavaradossi hasten out of the church. The Sacristan re-enters with choristers, celebrating the news that Napoleon has apparently been defeated at Marengo. The celebrations cease abruptly with the entry of Scarpia, his henchman Spoletta and several police agents. They have heard that Angelotti has sought refuge in the church. Scarpia orders a search, and the empty food basket and a fan bearing the Attavanti coat of arms are found in the chapel. Scarpia questions the Sacristan, and his suspicions are aroused further when he learns that Cavaradossi has been in the church; Scarpia mistrusts the painter, and believes him complicit in Angelotti's escape. When Tosca arrives looking for her lover, Scarpia artfully arouses her jealous instincts by implying a relationship between the painter and the Marchesa Attavanti. He draws Tosca's attention to the fan and suggests that someone must have surprised the lovers in the chapel. Tosca falls for his deceit; enraged, she rushes off to confront Cavaradossi. Scarpia orders Spoletta and his agents to follow her, assuming she will lead them to Cavaradossi and Angelotti. He privately gloats as he reveals his intentions to possess Tosca and execute Cavaradossi. A procession enters the church singing the Te Deum; exclaiming 'Tosca, you make me forget even God!', Scarpia joins the chorus in the prayer.
Scarpia, at supper, sends a note to Tosca asking her to come to his apartment. He has been unable to find Angelotti, but has arrested Cavaradossi. As Cavaradossi is brought in and questioned, the voice of Tosca, singing a celebratory cantata in another room in the Palace, can be heard. Cavaradossi denies knowing anything about Angelotti's escape. Tosca arrives, just in time to see her lover taken to an antechamber to be tortured. He is able to speak briefly with her, telling her to say nothing. Tosca is told by Scarpia that she can save her lover from indescribable pain if she reveals Angelotti's hiding place. She resists, but hearing Cavaradossi's cries of pain, eventually tells Scarpia that Angelotti is in the well in the garden of Cavaradossi's villa.
Scarpia orders the torture of Cavaradossi to cease and the wounded painter is brought back in. He recovers consciousness and, learning of Tosca's betrayal, is furious with her. Sciarrone, a police agent, enters with news of Napoleon's victory at Marengo; Cavaradossi gloats, telling Scarpia that his rule of terror will soon be at an end, before being dragged away by Scarpia's men. Scarpia, left with Tosca, proposes a bargain: if she gives herself to him, Cavaradossi will be freed. She is revolted, and repeatedly rejects his advances. Outside she hears the drums that announce an execution; as Scarpia awaits her decision, she prays to God for help, asking why He has abandoned her: "Vissi d'arte" ("I lived for art"). Scarpia remains adamant despite her pleas. When Spoletta brings news that Angelotti has killed himself, and that everything is in place for Cavaradossi's execution, Tosca, in despair, agrees to submit to Scarpia in return for Cavaradossi's freedom. Scarpia tells his deputy Spoletta to arrange a mock execution, both recalling that it will be "as we did with Count Palmieri".
Following Spoletta's departure, Tosca imposes the further condition that Scarpia provide a safe-conduct out of Rome for herself and her lover. While he is signing the document, Tosca quietly takes a knife from the supper table. As Scarpia triumphantly embraces her, she stabs him, crying "this is Tosca's kiss!". As Scarpia falls dead, she declares that she now forgives him. She removes the safe-conduct from his pocket, lights candles in a gesture of piety and places a crucifix on the body before leaving.
A shepherd boy sings (in Romanesco dialect) "Io de' sospiri" ("I give you sighs") as church bells sound for matins. Cavaradossi is led in by guards and informed that he has one hour to live. He refuses to see a priest, but asks permission to write a letter to Tosca. He begins to write, but is soon overwhelmed by memories: "E lucevan le stelle" ("And the stars shone"). Tosca enters and shows him the safe-conduct. She tells him that she has killed Scarpia and that the imminent execution is a sham: Cavaradossi must feign death, but afterwards they can leave Rome together, before Scarpia's body is discovered. Cavaradossi is amazed at the courage shown by one so gentle and tender: "O dolci mani" ("Oh sweet hands"). The pair ecstatically plan the life they will live away from Rome. Tosca then anxiously instructs Cavaradossi on how to play his part in the mock execution convincingly. She tells him that he will be shot with blanks by the firing squad and instructs him to fall down as if dead. He agrees to act "like Tosca in the theatre".
Cavaradossi is led away, and Tosca watches with increasing impatience as the execution is prepared. The men fire, Cavaradossi falls, and Tosca exclaims "Ecco un artista!" ("What an actor!"). When the soldiers have all left, she hurries towards Cavaradossi, only to find that he is really dead; Scarpia has betrayed her. Heartbroken, she clasps his lifeless body and weeps. The voices of Spoletta, Sciarrone and soldiers are heard, indicating that Scarpia's body has been found, and that Tosca is known to have killed him. As Spoletta, Sciarrone and the soldiers rush in, Tosca rises, evades their clutches, and runs to the parapet. Crying "O Scarpia, Avanti a Dio!" ("O Scarpia, we meet before God!"), she hurls herself over the edge to her death.