Hermann, an ethnic German, is an officer of the engineers in the Imperial Russian Army. He constantly watches the other officers gamble, but never plays himself. One night, Tomsky tells a story about his grandmother, an elderly countess. Many years ago, in France, she lost a fortune at faro, and then won it back with the secret of the three winning cards, which she learned from the notorious Count of St. Germain. Hermann becomes obsessed with obtaining the secret.
The countess (who is now 87 years old) has a young ward, Lizavyeta Ivanovna. Hermann sends love letters to Lizavyeta, and persuades her to let him into the house. There Hermann accosts the countess, demanding the secret. She first tells him that story was a joke, but Hermann refuses to believe her. He repeats his demands, but she does not speak. He draws a pistol and threatens her, and the old lady dies of fright. Hermann then flees to the apartment of Lizavyeta in the same building. There he confesses to frightening the countess to death with his pistol. He defends himself by saying that the pistol was not loaded. He escapes from the house with the aid of Lizavyeta, who is disgusted to learn that his professions of love were a mask for greed.
Hermann attends the funeral of the countess, and is terrified to see the countess open her eyes in the coffin and look at him. Later that night, the ghost of the countess appears. The ghost names the secret three cards (three, seven, ace), tells him he must play just once each night and then orders him to marry Lizavyeta. Hermann takes his entire savings to Chekalinsky's salon, where wealthy men gamble at faro for high stakes. On the first night, he bets it all on the three and wins. On the second night, he wins on the seven. On the third night, he bets on the ace—but when cards are shown, he finds he has bet on the Queen of Spades, rather than the ace, and loses everything. When the Queen appears to wink at him, he is astonished by her remarkable resemblance to the old countess, and flees in terror. In a short conclusion, Pushkin writes that Lizavyeta marries the son of the Countess' former steward, a state official who makes a good salary. Hermann, however, goes mad and is committed to an asylum. He is installed in Room 17 at the Obukhov hospital; he answers no questions, but merely mutters with unusual rapidity: "Three, seven, ace! Three, seven, queen!"