In late 1945, one-armed John J. Macreedy (Spencer Tracy) gets off a passenger train at the isolated desert hamlet of Black Rock. It is the first time in four years that the train has stopped there. Macreedy is looking for a man named Komoko, but the few residents are inexplicably hostile. The young hotel desk clerk, Pete Wirth (John Ericson), claims he has no vacant rooms. Macreedy is threatened by Hector David (Lee Marvin). Later, Reno Smith (Robert Ryan) informs Macreedy that Komoko, a Japanese-American, was interned during World War II.
Certain that something is wrong, Macreedy sees the local sheriff, Tim Horn (Dean Jagger), but the alcoholic lawman is clearly afraid of Smith and is impotent to help. The veterinarian and undertaker, Doc Velie (Walter Brennan), advises Macreedy to leave town immediately, but also lets slip that Komoko is dead. Pete's sister, Liz (Anne Francis), rents Macreedy a Jeep. He drives to nearby Adobe Flat, where he finds a homestead burned to the ground and wildflowers. On the way back, Coley Trimble (Ernest Borgnine) tries to run him off the road.
When Smith asks, Macreedy reveals he lost his left arm fighting in Italy. Macreedy says the wildflowers at the Komoko place lead him to suspect that a body is buried there. Smith reveals that he is virulently anti-Japanese; he tried to enlist in the Marines the day after the attack on Pearl Harbor, but failed the physical.
Macreedy tries to telephone the state police, but Pete refuses to put the call through. Doc Velie admits that something terrible happened four years ago and that Smith has everyone too terrified to speak up. Velie offers Macreedy his hearse to leave town. Hector rips out the distributor cap and spark plug wires. Macreedy goes to Hastings' (Russell Collins) telegraph office and writes a telegram addressed to the state police. At the town diner, Trimble picks a fight with Macreedy, but Macreedy uses martial arts to beat him up. Macreedy tells Smith that he knows Smith killed Komoko and that he was too cowardly to do it alone, so he involved Hector, Pete, and Coley.
When Macreedy goes to the hotel lobby, Smith and his henchmen are already there, as are Doc Velie and Sheriff Horn. Hastings arrives and tries to give Smith a piece of paper, but Macreedy snatches it away and discovers that it is his own unsent telegram. Macreedy and Doc Velie demand that Sheriff Horn do something. When Horn tries, Smith just takes away his sheriff's badge and pins it on Hector. Hector tears up the telegram form.
After Smith and Hector leave, Macreedy reveals that the loss of his arm had left him wallowing in self-pity, but Smith's attempt to kill him has reinvigorated him. Macreedy finally reveals why he is there: Komoko's son died in combat while saving Macreedy's life. Macreedy intended to give his posthumous medal to Komoko. In turn, Macreedy learns that the elder Komoko had leased some farmland from Smith, who was sure there was no water there. Komoko had dug a well and found water. After Smith was turned down for enlistment after Pearl Harbor, he and the other men spent the day drinking, then decided to scare Komoko. The old man barricaded himself inside his home, but the men set the place on fire. When Komoko emerged ablaze, Smith shot him.
Later, Macreedy and Doc Velie devise a plan for Macreedy to escape under the cover of darkness. Hector is standing guard outside the hotel; Pete lures him into the hotel office, where Doc Velie knocks him out. Liz drives Macreedy out of town in her Jeep, but stops in a canyon. Macreedy realizes he has been betrayed. When Smith starts shooting at him, Macreedy hides behind the Jeep. Liz rushes to Smith despite Macreedy's warning. Smith tells her that she has to die along with the rest of his accomplices. He shoots her in the back as she runs away. Macreedy finds a bottle and fills it with gasoline, creating a Molotov cocktail. When Smith climbs down for a better shot, Macreedy lights and throws it, setting Smith on fire.
Macreedy drives into town with the injured Smith and Liz's body. The state police are called in. As Macreedy is leaving, Doc Velie requests Komoko's medal to help Black Rock heal. Macreedy gives it to him just before boarding the train.

Question: Who betrays Macreedy in the canyon?
Answer: Liz
Alternative answer: Liz and Smith.