St Petersburg, 1806. Gambling fever is sweeping the city, particularly the game of Faro, where the Queen of Spades is considered an unlucky card. Herman Suvorin watches enthralled night after night, but he never plays. As he explains bitterly to his aristocratic friend, Andrei, he is only a humble Captain of the Engineers and has to save, not risk his money.
One day, while visiting a bookshop, he happens on a volume about the secrets of the notorious Count de St Germain, which includes a chapter entitled 'The Secret of the Cards'. In particular it tells the scandalous story of Countess Ranevskaya, who admitted a young lover into her room through a secret stairway but then found herself compromised when the man steals her husband's money. In desperation she visited the Count's palace and drawn from him the secret of the cards, which enabled her to go afterwards to the gaming room and win a fortune. However, the horror of her visit to the Count's palace has scarred her soul for life.
Reading the book while walking, and completely absorbed by this tale, Herman is amazed suddenly to find himself outside the Countess's house. He notices her young ward, Lizaveta, at the window and begins to devise a plan whereby he can use her to gain entrance. He writes romantic love letters to her which he copies from a book. In one he says he will kill himself if she does not meet him that night at the opera where she is accompanying the Countess. During the interval she steals away to see Herman, who professes his love for her and persuades her to agree to a secret assignation in the house. However, the two have been seen by Andrei, who is genuinely in love with Lizaveta. When Andrei goes to visit Herman and discovers one of his love letters inside a book of 'Letters to a Young Lady of Quality', he suspects him of planning a calculated seduction. He threatens a confrontation with Herman if any harm befalls Lizaveta.
Accompanying the Countess to a Ball, Lizaveta leaves a candle in her window as a signal for Herman to enter and wait. However, in their earlier conversation, he has tricked her into disclosing the location of the Countess's room, and it is there that he hides. When the Countess returns, he startles her and demands the secret of the cards; when she refuses, he threatens her with a pistol. The shock is too much for the old woman and she dies. Distraught, he goes to Lizaveta and tells her what has happened. She is appalled, but, to ensure he leaves the house unseen, tells him of the secret staircase in the Countess's room (which she accidentally discovered one day). As he makes his escape, the Countess seems to be staring at him with her dead eyes.
At the Countess's funeral, Herman comes to pay his respects, but when he leans over her open coffin, her eyes open and he lets out a howl of fear. Later, awakening from a troubled sleep, he hears the sound of the Countess's walking stick and of her cloak scraping across the floor, which terrifies him; but he also hears her voice disclosing the secret of the cards to him - 'Three' 'Seven' 'Ace' - and promising to forgive him her death if he marries Lizaveta. He draws out all his savings and hurries to the house to propose to her but she now despises him. Later that night, in the Gambling Room, Andrei confronts Herman and strikes him for the pain he has caused Lisaveta. Herman challenges him to a game of Faro and gambles all his savings. He wins the first two cards, but the third, which he thought must be an Ace, turns out to be the Queen of Spades. Herman goes mad and is led out of the Card Room by Andrei deliriously murmuring 'Three, Seven, Ace...' A new morning is heralded by the tolling of bells. The young lovers, Andrei and Lizaveta, go to the bird market and, to her delight, free the birds from their cages.