During the reign of Catherine the Great (1762–96), children are at play in St. Petersburg's Summer Garden pretending to be soldiers. Two officers — Tsurin and Chekalinsky — enter, the former complaining about his bad luck at gambling. They remark that another officer, Herman, seems obsessed with the gaming table but never bets, being frugal and methodical. Herman appears with Tomsky, who remarks that his friend hardly seems like his old self. Herman admits he is in love with a girl above his station whose name he does not even know. When Prince Yeletsky, an officer, strolls into the park, Chekalinsky congratulates him on his recent engagement. Yeletsky declares his happiness while Herman, aside, curses him enviously. Yeletsky points out his fiancée, Liza, who has just appeared with her grandmother, the old Countess. Catching sight of Herman, the two women note they have seen him before, staring at them with frightening intensity. Herman realizes that Liza is his unknown beloved. When Yeletsky and the women leave, Herman is lost in thought as the other officers discuss the Countess: known as the Queen of Spades and formerly as the Muskovite Venus, due to her beauty, she succeeded at gambling in her youth by trading amorous favors for the winning formula of Count St. Germain in Paris. Tomsky says only two men, her husband and, later on, her young lover, ever learned her secret, because she was warned by an apparition to beware a "third suitor" who would try to force it from her. Musing on the winning sequence of three cards, the others lightly suggest that such a combination would solve Herman's problems. Threatened by approaching thunder, all leave except Herman, who vows to learn the Countess' secret.
At home, Liza plays the spinet as she and her friend Pauline sing a duet about evening in the countryside. Their girlfriends ask to hear more, and as the merriment increases, Liza remains pensively apart. A Governess chides the girls for indulging in unbecoming folk dancing and asks the visitors to leave. Pauline, the last to go, urges Liza to cheer up; Liza replies that after a storm there is a beautiful night and asks the maid, Masha, not to close the French windows to the balcony. Alone, Liza voices her unhappiness with her engagement; she has been stirred by the romantic look of the young man in the park. To her shock, Herman appears on the balcony. Claiming he is about to shoot himself over her betrothal to another, he begs her to take pity on him. When the Countess is heard knocking, Liza hides Herman and opens the door to the old woman, who tells her to shut the windows and go to bed. After the Countess retires, Liza asks Herman to leave but is betrayed by her feelings and falls into his embrace.
Not long afterward, at a masked ball, Herman's comrades comment on his obsession with the secret of the winning cards. Yeletsky passes with Liza, noting her sadness and reassuring her of his love. Herman receives a note from Liza, asking him to meet her later. Tsurin and Chekalinsky sneak up behind him with the intent of playing a joke on him, muttering he is the "third suitor" who will learn the Countess's secret, then melt into the crowd as Herman wonders whether he is hearing things. Liza slips Herman the key to her grandmother's room, saying the old woman will not be there the next day, but Herman insists on coming that very night. Thinking fate is handing him the Countess' secret, he leaves.
Herman slips into the Countess' room and looks in fascination at the portrait of Muskovite Venus and how their fates, he feels, are linked: one of them will die because of the other. He lingers too long before he can go to Liza's room and hears the Countess' retinue coming, so he conceals himself as the old lady approaches. The Countess deplores the manners of the day and reminisces about the better times of her youth. As she dozes off, Herman stands before her. She awakens in horror as he pleads with her to tell him her secret. When she remains speechless, he grows desperate and threatens her with a pistol — at which she dies of fright. Liza rushes in, only to learn that the lover to whom she gave her heart was more interested in the Countess's secret. She orders him out and falls sobbing.
In his room at the barracks, as the winter wind howls, Herman reads a letter from Liza, who wants him to meet her at midnight by the river bank. He imagines he hears the chorus chanting at the old Countess' funeral, then is startled by a knock at the window. The old woman's ghost appears, announcing that against her will she must tell him the secret so that he can marry and save Liza. Dazed, Herman repeats the three cards — three, seven, ace.
By the Winter Canal, Liza waits for Herman: it is already near midnight, and though she clings to a forlorn hope that he still loves her, she sees her youth and happiness swallowed in darkness. At last he appears, but after uttering words of reassurance, he starts to babble wildly about the Countess and her secret. No longer even recognizing Liza, he rushes away. Realizing that all is lost, she commits suicide.
At a gambling house, Herman's fellow officers are finishing supper and getting ready to play faro. Yeletsky, who has not gambled before, joins the group because his engagement has been broken, hoping to have a better luck in cards than in love. Tomsky entertains the others with a song. Settling down to play, they are surprised when Herman arrives, wild and distracted. Yeletsky senses a confrontation and asks Tomsky to be his second if a duel should result. Herman, intent only on betting, starts with a huge bet of 40,000 rubles. He bets the three and wins, upsetting the others with his maniacal expression. Next he bets the seven and wins again. At this he takes a wine glass and declares that life is but a game. Yeletsky accepts his challenge to bet on the next round. Herman bets everything he has on the ace but when he shows his card he is told he is holding the queen of spades. Seeing the Countess' ghost laughing at her vengeance, Herman takes his own life and asks Yeletsky's and Liza's forgiveness. The others pray for his tormented soul.