The movie revolves around the life of a mercenary by the name of Angel Eyes. He is hired by Baker to kill Bill Carson's, a thief who stole gold from the Confederates. When he is questioning Confederate soldier Stevens, Stevens manages to convince him to kill Baker and offers him $1000 for doing so. He takes the contract but kills Stevens. He then goes to Baker, takes his fee, then kills him, thereby completing Steven's contract as well.
Elsewhere, Tuco Ramirez, a bandit, is saved from bounty hunters by Blondie, who takes him to the Sheriff in order to receive the $2,000 bounty. When the Sheriff decides to hang Tuco, Blondie sets him free and the two escape. They then continue to make money this way in other towns. However, Tuco soon begins to grow tired and bored of their adventures, so Blondie leaves him in the desert. Angered, Tuco travels to find Blondie where he discovers Blondie in a Confederate town. He tries to get Blondie to hang himself but Blondie manages to escape. He tracks Blondie down again and makes him walk across the desert. Blondie, dehydrated, collapses. Tuco decides to shoot Blondie but a carriage arrives, with Bill Carson inside it. Carson makes a deal with Tuco for $200,000 in gold however Carson dies before he can reveal where the gold is. However, Blondie reveals that Carson told him the name on the grave where the gold was buried, when Tuco was getting water for Carson. Tuco keeps Blondie alive but the two are captured by Union soldiers. Angel Eyes is disguised as a Unionist and manages to retrieve the information of the cemetery from Tuco. However, Blondie does not succumb to questioning so Angel Eyes makes a deal with him to split the gold. Tuco manages to escape as well.
Blondie and Tuco reunite at the town of the gold, and decide to resume their old partnership. They both kill Angel Eyes' shoulder but realize that Angel Eyes managed to escape. They both attempt to blow up the bridge where Union troops are in order to get to the cemetery. Blondie reveals to Tuco the name of the grave where the gold is, as Arch Stanton. Tuco runs off to get the gold for himself and begins digging in the grave. Blondie too arrives and hold a gun to him. Angel Eyes then arrives and all three of them find that the grave is empty with just a skeleton. Blondie says that he gave the fake name of the grave.
All three then engage in a three way duel where Blondie kills Angel Eyes and reveals that the gold is buried next to Arch Stanton, the one named Unknown. Tuco realizes he has no bullets and Blondie forces him into a noose where he balances unsteadily on a grave. Blondie takes half the gold and then shoots the noose, therefore letting Tuco live to take his half.