A stranger arrives at the little town of San Miguel. Silvanito, the town's innkeeper, tells the Stranger about a feud between two families vying to gain control of the town: the Rojo brothers: Benito, Esteban and Ramón and that of the town sheriff, John Baxter. The Stranger decides to play each family against the other in order to make money, and proves his speed and accuracy with his gun to both sides by shooting with ease the four men who insulted him as he entered town.
The Stranger seizes his opportunity when he sees the Rojos massacre a detachment of Mexican soldiers who were escorting a chest of gold that they'd planned to exchange for a shipment of new rifles. He takes two of the dead bodies to a nearby cemetery and sells information to both sides, saying that two Mexican soldiers survived the attack. Both sides race to the cemetery; the Baxters to get the "survivors" to testify against the Rojos, and the Rojos to silence them. The factions engage in a gunfight, with Ramón managing to "kill" the "survivors" and Esteban capturing John Baxter's son, Antonio.
While the Rojos and the Baxters are fighting, the Stranger searches the Rojo hacienda for the gold. While he is searching he accidentally knocks out a woman, Marisol. He takes her to the Baxters, who, in turn, arrange to return her to the Rojos in exchange for Antonio. During the exchange, Marisol's son, Jesús, runs towards her, followed by her husband, Julio. While the family embraces, Ramón orders one of his men, Rubio, to kill her husband as he has already told him to leave town. Silvanito attempts to protect the family with a shotgun with the Stranger backing him up. Neither Ramón nor any of his men attempt to challenge the Stranger, knowing that he is too fast on the draw.
The Stranger then tells Marisol to go to Ramón and for Julio to take Jesús home. He learns from Silvanito that Ramón had framed Julio for cheating during a card game and taken Marisol as his prisoner, forcing her to live with him. That night, while the Rojos are celebrating, the Stranger rides out and frees Marisol, shooting the guards and wrecking the house in which she is being held, making it appear as though it were attacked by the Baxters. He gives Marisol some money and tells her family to leave the town.
When the Rojos discover that the Stranger freed Marisol, they capture and torture him, but he escapes. Believing him to be protected by the Baxters, the Rojos set fire to the Baxter home and massacre the entire family as they run out of the burning building. Ramon kills John Baxter and Antonio after pretending to spare them. Consuelo, John Baxter's wife, appears and curses the Rojos for killing her unarmed husband and son. She is then shot and killed by Esteban.
With help from Piripero, the local coffin-maker, the Stranger escapes town by hiding in a coffin. He hides and convalesces in a nearby mine. When Piripero tells him that Silvanito has been captured, the Stranger returns to town to face the Rojos. With a steel chest-plate hidden beneath his poncho, he taunts Ramón to "aim for the heart" as Ramón's shots bounce off. Panicking, Ramón uses up all of the bullets in his Winchester.
The Stranger shoots the rifle from Ramón's hand and kills the other Rojos standing nearby, including Don Miguel and Rubio. He then uses the last bullet in his gun to free Silvanito, tied hanging from a post. After challenging Ramón to reload his rifle faster than he can reload his own pistol, the Stranger shoots and kills Ramón. Esteban Rojo aims for the Stranger's back from a nearby building, but is shot dead by Silvanito. The Stranger bids farewell and rides away from the town.