A gang of outlaws led by Pike Bishop (William Holden) rob a bank in southern Texas, with plans on using the money to retire. When the robbery goes bad, and some of the gang are killed, Pike and the surviving members (Ernest Borgnine, Edmond O'Brien, Ben Johnson, Warren Oates, Jaime Sanchez) flee to Mexico. Bishop's ex-partner Deke Thornton (Robert Ryan) and his gang of bounty hunters, who have been chasing Bishop and his gang for a long time, follow them across the border. Still wanting one last score before going their separate ways, Bishop and the gang agree to steal several cases of guns from the US Army for Mexican General Mapache in exchange for $10,000 in gold. Mapache says he wants the guns to fight Pancho Villa.
Angel, one of the gang members, takes one of the cases of guns to give to the village where they were hiding because it was previously attacked by Mapache's men. When the General finds out that Angel took one of the cases, he has him taken from the gang and brutally attacked. Even though they have their gold and can leave at any time, Bishop and the rest of the gang decide to go get Angel back from the General.
When the gang confronts the General and his men, Mapache agrees to return Angel to Bishop. However, he changes his mind and kills Angel instead. Enraged, Bishop kills the General, which sets off a huge gun battle between the gang and about 200 Mexican soldiers. The extremely bloody battle lasts for several minutes, in which most of the soldiers and some of the townspeople are killed. Bishop and his men are also killed in the battle. Thornton and his men come to the town just after the battle, and pick up the bodies of Bishop and the gang to take back to the USA and claim their reward.