An old legend tells of a fortune in gold hidden in the “Cañon del Oro”, later called “The Lost Adams”, guarded by the Apache spirits. A man named Adams is said to have found it when he was young, only to have the Indians capture and blind him and kill his companions. Years later, Marshal MacKenna (Gregory Peck), a one-time gold prospector himself, wounds an old Indian shaman named Prairie Dog (Eduardo Ciannelli) who tried to ambush him. Prairie Dog subsequently dies despite MacKenna’s attending to him. MacKenna thereby comes into possession of a map that supposedly shows the way to the treasure. Though sceptical, he memorises the directions before burning the map.
Mexican outlaw John Colorado (Omar Sharif) and his gang have been tracking Prairie Dog to get the map, all the while being chased by the US Cavalry. They take shelter in the house of the old judge of the town of Hadleyburg, kill the judge and kidnap his daughter, Inga Bergmann (Camilla Sparv), to use as a hostage in case the cavalry catches up with them.
Colorado finds MacKenna digging a grave for Prairie Dog. When he sees that MacKenna has burned the map, he takes Mackenna captive, intending to force him to lead them to the gold. They return for the night to Colorado’s secret hideout to be safe from both the cavalry and marauding Apaches, who are also seeking the gold. The gang is made up of outlaws, including Colorado’s right-hand man, Sanchez (Keenan Wynn), and several Indians, among them a hulking Apache warrior named Hachita (Ted Cassidy) and a fiery Apache woman, Hesh-ke (Julie Newmar). Colorado and his companions feel vengeful towards MacKenna: he had previously run them out of the territory; and Hesh-ke and MacKenna were once lovers.
The next morning Ben Baker (Eli Wallach), a gambler from the town of Hadleyburg, arrives with assorted townsmen who have caught “gold fever”. They have learned about Colorado’s plans, including his hideout, when one of his men got drunk in town and said too much. Colorado is forced to allow them to join his party. The townsmen include two wandering Englishmen (Anthony Quayle and J. Robert Porter) who overheard Baker’s conversation with the others; a newspaper editor, (Lee J. Cobb); a storekeeper, (Burgess Meredith); a preacher, (Raymond Massey), who has convinced himself that God wants him to get a share of the gold and do great religious deeds with it; and blind Adams (Edward G. Robinson) himself, of the legend. Colorado persuades old Adams to retell the story of how he discovered the canyon. The tale further raises the hopes of the gold-seekers, but later, when MacKenna sneaks off and warns a few of them to return home and that they will just get themselves killed searching for gold that does not exist (he says the tale Adams told is just a story he uses to get free drinks), they hesitate. However, when Colorado steps in and reveals that MacKenna shot Prairie Dog, the townsmen, who never liked MacKenna, are convinced to continue the quest.
The cavalry, led by the cunning Sergeant Tibbs (Telly Savalas), has been following Colorado’s party closely, and has unbeknownst to them camped just outside his hideout. The party bypasses the cavalry by an ingenious diversion, during which MacKenna tries unsuccessfully to escape with Inga. But shortly thereafter the cavalry ambushes the party at a water hole, and most of the supporting members of the gang are killed. The remaining gold hunters continue on their way, and as they near the canyon MacKenna and Inga begin to fall in love. A jealous Hesh-Ke, who now wants MacKenna back, twice tries to kill Inga but each time she is prevented from doing it.
The cavalry is continuing its pursuit, and Sergeant Tibbs periodically sends messengers back to his base to keep it informed of his whereabouts. Eventually, the patrol is whittled down to just Tibbs and two others. Tibbs kills them and persuades Colorado he should be allowed to join the gang. After another shoot-out with the Apaches, and crossing dangerous river rapids, they reach “Shaking Rock”, the location where according to the map the gold is. MacKenna tells Colorado they will see the canyon the next morning.
That night the two of them talk in almost a friendly way about what Colorado plans to do with his share of the gold. Later Tibbs tries to enlist MacKenna in a conspiracy against Colorado, but MacKenna wants no part of it. He tells Inga to be alert for any opportunity to escape. When she protests that she too wants some gold he tells her emphatically there is no gold, that he has just been bluffing. MacKenna and Inga embrace, with Hesh-ke looking on enviously. Hachita spends the night looking at the moon.
The next morning everyone is up and mounted before sunrise. When the first beam of sunlight shines down, it sets off an optical reaction that startles the horses. Then the shadow of the pinnacle of “Shaking Rock” starts to move. Watching this, MacKenna for the first time believes in the legend. The shadow eventually ends at a hidden passageway cutting into a mountainside. They ride through it and emerge on the other side.
They see below them a large vein of pure gold. As all race to the canyon floor, Hesh-ke tries to kill Inga, but Inga fights back and Hesh-ke falls to her death. Once on the floor, while Colorado and Tibbs celebrate their great fortune, MacKenna, realising that Colorado does not intend to leave any of the party alive, tries to escape with Inga up the canyon wall. Tibbs, his attention diverted while stuffing his saddle bags with gold nuggets, is killed by Hachita with a thrown tomahawk. Colorado then pulls his gun on Hachita, only to find that his weapon is unloaded. Hachita tells him that during the night he took the bullets out of Colorado’s gun, as the spirits had told him to do, and that Colorado also has to be killed because he is not Apache. However, Hachita turns his back on Colorado, who kills him with a knife he had earlier taken from Hesh-ke.
Colorado pursues MacKenna and Inga, catching up to them at an ancient Indian dwelling high up the cliff. They fight. Colorado has Hachita’s tomahawk so is the early aggressor, and would kill MacKenna but for Inga’s desperate intervention. MacKenna gains the advantage over Colorado with some punishing blows, rendering him helpless. At that moment the marauding Apaches, presumably having followed the party’s tracks into the mountain, enter the canyon and shoot up at the three. The Apaches thunder down to the canyon floor, shouting excitedly. However, the noise and the pounding of the horses causes a rockfall which in turn causes the valley floor to buckle and quake. The Apaches flee, and the three survivors descend the cliff and scramble for horses, barely escaping the collapse of the canyon walls, which buries the gold beyond reach. This is followed by the crash of “Shaking Rock”.
Stunned and exhausted, Colorado and MacKenna face each other. Colorado tells MacKenna to stay away from him. MacKenna tells Colorado to go far away and hide, and that he will be coming after him. MacKenna and Inga ride off together. The camera tilts down to the left side of MacKenna’s mount, which happens to be Sgt. Tibbs’ horse, its saddle bags stuffed with gold nuggets.