Fred Dobbs (Humphrey Bogart) and Bob Curtin (Tim Holt) are down on their luck in Mexico and are both victims of a swindle in which workers are hired but not paid by a notoriously corrupt local businessman (Barton MacLane). Intrigued in the local pub by the stories of Howard (Walter Huston), an old burnt-out gold prospector keen on finding business partners to go prospecting, they cannot join him because they don't have enough money. When Dobbs makes a small score in a local lottery, that changes, and they hook up with Howard and set off for the hills.
They find land on which much gold can be mined, and they split the gold equally, with each hiding and tending to his individual share. One day, Curtin sees a gila monster (a venomous lizard) and resolves to kill it, but it hides under a rock. Curtin will have to lift the rock to shoot it, but when Dobbs, whose gold, coincidentally, is hidden under this same rock, sees Curtin lifting it, even after seeing the gila monster, he fears that his goods will soon be stolen by one of the others. When another man named Cody (Bruce Bennett) finds them and insists on becoming their partners in prospecting, they resolve to shoot him. Before they do so, however, a group of bandits led by Gold Hat (Alfonso Bedoya) finds them and the bandits try to barter for some of their weapons, but these weapons are indispensable to the men and they refuse to do business. This results in exchange of gunfire, and Cody, who helps to defend the men, is killed. The bandits are ultimately scared away, and gold prospecting continues until they have mined enough gold to be prosperous for the remainder of their lives.
All that remains is to take their gold back to the city where they can sell it, but this will require an arduous trip through the desert. Early in the trip, Howard, a man known to be skilled in the ways of medicine, is forced by some primitive local people to return with them to treat an ill child, and has little choice but to trust Dobbs and Curtin to hold his share of the goods until he returns to them. Curtin has every intention of doing this, but Dobbs remains suspicious of Curtin, believing that Curtin will kill him the very moment he goes to sleep. Troubled by this, he tries to murder Curtin, and soon holds all the goods, but he must now make a long trip through the desert alone.
Unfortunately for Dobbs, he encounters Gold Hat on his trip, and Gold Hat, who recognizes him, murders him and takes his goods. Gold Hat returns to the city to sell the goods, but once it is determined that he has stolen the goods he holds, he is executed by firing squad. When it turns out that Curtin has survived, and when Howard returns, it soon becomes clear that their fortune is missing, and they share an unexpected laugh, appreciating that, despite their bad luck, they were far more prosperous than Dobbs and Gold Hat.
Life, Curtin and Howard understood, would go on, and their unbroken spirit made them symbols of resolve in the face of adversity.