In Prohibition-era Texas, a mysterious character (later identifying himself as "John Smith") (Bruce Willis) drives into Jericho, near the Mexican border. The town is virtually deserted except for two feuding bootleg gangs – the Italians under Strozzi, and the Irish under Doyle – that have driven the other residents away, aside from the bartender Joe Monday (William Sanderson), an undertaker, a mechanic, and a corrupt sheriff (Bruce Dern), all of whom make their living by catering to Jericho's criminal elements.
Smith immediately establishes a reputation by outdrawing and killing Doyle's top shooter, a brazen act that gets the attention of both gangs. Smith promptly hires himself out to Strozzi's gang for what Strozzi (Ned Eisenberg) predicts is an upcoming gang war. Seeing an opportunity to make some easy money while he is on the way to Mexico, he begins playing the two gangs against each other. This includes seducing Strozzi's mistress, Lucy (Alexandra Powers) and slipping information to Doyle's gang through the Sheriff.
The gang war re-starts when Strozzi suborns a corrupt Mexican police captain escorting a convoy of Doyle's trucks through Mexico to Doyle (David Patrick Kelly). The Mexican police murder Doyle's men and turn the trucks over to Strozzi.
Smith then quits Strozzi's gang and hires himself to Doyle's, bringing valuable information with him. Doyle's right-hand man, Hickey (Christopher Walken), interrupts a meeting between the Mexican police captain and Strozzi's cousin Giorgio (Michael Imperioli). After killing the captain (along with a corrupt Border Patrol officer), Hickey takes Giorgio hostage and Doyle demands that Strozzi give up his entire operation in exchange for him. Strozzi forces a stalemate by kidnapping Felina (Karina Lombard), Doyle's captive mistress. Doyle agrees to exchange the two prisoners and the two gangs scatter.
Smith is summoned by the Sheriff to meet with Captain Tom Pickett (Ken Jenkins) of the Texas Rangers, who is upset over the death of the Border Patrol officer. He warns that he can tolerate one gang in Jericho, but not two and if more than one remains in Jericho in ten days time, he will bring a squad of Rangers into Jericho and wipe out both gangs.
Lucy comes to Smith and reveals that Strozzi, angered after the exchange, beat her and had Giorgio cut her ear off when she revealed her affair with Smith. Smith gives her some money and puts her on a bus out of Jericho. The next day Smith relays a false rumor that Strozzi is bringing in more soldiers. Playing on Doyle's obsession with Felina, he makes Doyle afraid that Strozzi will try to kidnap her again, and Doyle orders Smith to the safehouse where Felina is. Smith kills the men guarding Felina and sends her away with a car and a roll of money.
The next day, Smith is waiting at the safehouse when Doyle arrives, and claims that he arrived too late, Strozzi's men had already killed the guards and abducted Felina. Doyle goes berserk and declares all-out war on Strozzi's gang.
Smith's plan goes awry when Hickey puts together the truth. Doyle imprisons Smith and has him tortured, demanding to know where Felina is. Smith refuses to talk. Later that night, he escapes by killing two of Doyle's men, and escapes town with the aid of Joe Monday and the Sheriff. As they are driving out of town, they see Doyle's gang slaughtering Strozzi's at a roadhouse. Strozzi and Giorgio are the last two to die.
Smith takes refuge at a remote church where Felina went to pray. Two days later, Sheriff Galt arrives and informs Smith that Joe was caught smuggling food and water to Smith and that Doyle will probably torture him to death. He then hands Smith his twin Colt .45s and informs him that that is all the help Smith can expect from him.
Smith returns to town and storms Doyle's headquarters, gunning down the remainder of his men and rescuing Joe. Doyle and Hickey are absent, having gone down to Mexico in a desperate search for Felina.
In the final scene, Doyle, Hickey and Sheriff Galt's corrupt deputy Bob, confront Smith at the burned-out remains of Strozzi's hideout. Doyle, still despondent over the loss of Felina, tells Smith they can be partners and begs him to reveal where to find her. Before he can get further, Joe shoots Doyle with an antique pistol, and Smith shoots Bob before he can retaliate.
Hickey drops his submachine gun and says he doesn't want to die in Texas ("Chicago maybe") and starts to walk away (as seen in the earlier scene with the Border Patrol officer, this is just a ploy to invite the other man to shoot him in the back, allowing Hickey to turn and gun him down). With lightning speed he turns and quickdraws a pistol from his holster, but Smith is faster, and kills Hickey.
Smith gets into his car and drives on to Mexico, his original destination. He reflects that he is as broke as he was when he first arrived, having given all the money he made off the two gangs to various women in order to get them out of town, including Felina and Lucy. However, he consoles himself that everyone in the two gangs is better off dead.