During the final days of the American Civil War, the Union army payroll train is hijacked by Confederates led by Capt. Pierre Cordona and Sgt. Tuscarora Phillips. Their scheme suggests that the Confederates must have gotten detailed inside information about the transport. Col. Cord McNally’s close friend, Lt. Ned Forsythe, is fatally injured in the raid, and during the pursuit McNally’s squad is spread thinner and thinner until he is left on his own. After Cordona and his men capture him, McNally tricks them by leading them into a Union camp and raising the alarm. Cordona and Tuscarora are captured, but will not reveal to McNally the identity of the traitor who sold them the information about the train.
Despite this development, the three men gain a mutual respect for each other, and after the war ends, McNally visits Cordona and Phillips as they are being released. He asks them once more about the traitors, but all they can provide is a physical description. McNally then tells Cordona and Tuscarora that if they should come across these men again, to contact him through a friend of his, Pat Cronin, who is the sheriff of Blackthorne in Texas.
Sometime later, McNally is contacted by Pat with a message from Cordona, who is staying at the local hotel. When he arrives in Blackthorne, McNally meets a young woman, Shasta Delaney, who has come to report the murder of her employer by a deputy of Rio Lobo’s sheriff, “Blue Tom” Hendricks. Shortly afterwards, a posse from Rio Lobo arrives and wants to take Delaney away. Delaney identifies their leader, “Whitey” Carter, as the murderer she was referring to. When one of the posse aims a gun at Cronin, Delaney shoots Whitey from under the table, resulting in a shoot-out in which McNally, Cronin and Cordona finish off the posse.
Cordona identifies Whitey as one of the traitors McNally is looking for. He tells McNally that Tuscarora had contacted him and told him that his father and other ranchers are having land stolen by a rich man named Ketcham, who had the previous sheriff killed and installed Hendricks in his place. McNally, Cordona, and Delaney go to Rio Lobo, where they find the people living in terror of Hendricks and his men. Tuscarora’s girlfriend Maria hides them in her house, and her friend Amelita helps Cordona scout out the territory. Hendricks has Tuscarora arrested on trumped-up charges, so McNally’s group goes to get help from Tuscarora’s father, Old Man Philips.
McNally, Cordona, and Philips sneak into Ketcham’s ranch, and McNally discovers that Ketcham is really Union Sergeant Major Ike Gorman, the second traitor he was searching for. McNally attacks Gorman, who fights back with an oil lamp, accidentally setting himself and his house ablaze. McNally refuses to put out the fire until Gorman agrees to sign the deeds back to their rightful owners. Taking the wounded Gorman hostage, they send Cordona ahead to find the United States Cavalry. Upon arrival in Rio Lobo, they discover that Hendricks has beaten Maria and brutally slashed Amelita’s face, for helping McNally. Amelita swears to McNally she will kill Hendricks.
The men force Hendricks’ party out of the jail and hole up there with Tuscarora to await the Cavalry. However, Hendricks’ men capture Cordona before he gets far, and offer to trade him for Gorman. During the prisoner exchange, Cordona manages to give his captors the slip. McNally, wanting to keep Gorman for trial, tells Hendricks Gorman is no use to the sheriff since he signed back the deeds. Hendricks instead guns his boss down in rage, starting a firefight in which he and McNally are wounded.
After a failed attempt to blow up the cantina McNally’s men are using as a base, Hendrick’s men are outflanked by the rest of the townspeople, who have rallied to help. Hendrick’s men realize that all is lost, and they flee. Hendricks shoots at them, but he has been using his rifle as a crutch and, with its muzzle clogged with dust, it explodes in his face. As he stumbles to his horse, Amelita guns him down, thus keeping her promise and ridding the town of its final menace.