A recurring dream troubles Santiago, a young and adventurous Andalusian shepherd. He has the dream every time he sleeps under a sycamore tree that grows out of the ruins of a church. During the dream, a child tells him to seek treasure at the foot of the Egyptian pyramids. Santiago consults a gypsy woman to interpret the dream, and to his surprise she tells him to go to Egypt. A strange, magical old man named Melchizedek, who claims to be the King of Salem, echoes the gypsy’s advice and tells Santiago that it is his Personal Legend to journey to the pyramids. Melchizedek convinces Santiago to sell his flock and set off to Tangier. When Santiago arrives in Tangier, a thief robs him, forcing him to find work with a local crystal merchant. The conservative and kindly merchant teaches Santiago several lessons, and Santiago encourages the merchant to take risks with his business. The risks pay off, and Santiago becomes a rich man in just a year.
Santiago decides to cash in his earnings and continue pursuing his Personal Legend: to find treasure at the pyramids. He joins a caravan crossing the Sahara desert toward Egypt and meets an Englishman who is studying to become an alchemist. He learns a lot from the Englishman during the journey. For one, he learns that the secret of alchemy is written on a stone called the Emerald Tablet. The ultimate creation of alchemy is the Master Work, which consists of a solid called the Philosophers' Stone that can turn lead to gold, and a liquid called the Elixir of Life that can cure all ills. Santiago learns the Englishman is traveling with the caravan to the Saharan oasis of Al-Fayoum, where a powerful, 200-year-old alchemist resides. The Englishman plans to ask the alchemist the secret of his trade.
As it turns out, the caravan must make an extended stop in Al-Fayoum in order to avoid increasingly violent tribal wars taking place in the desert. There, Santiago falls in love with Fatima, who lives at the oasis. During a walk in the desert, Santiago witnesses an omen that portends an attack on the historically neutral oasis. He warns the tribal chieftains of the attack, and as a result, Al-Fayoum successfully defends itself against the assault. The alchemist gets word of Santiago’s vision and invites Santiago on a trip into the desert, during which he teaches Santiago about the importance of listening to his heart and pursuing his Personal Legend. He convinces Santiago to leave Fatima and the caravan for the time to finish his journey to the pyramids, and he offers to accompany Santiago on the next leg of his trip.
While the alchemist and Santiago continue through the desert, the alchemist shares much of his wisdom about the Soul of the World. They are mere days away from the pyramids when a tribe of Arab soldiers captures them. In exchange for his life and the life of Santiago, the alchemist hands over to the tribe all of Santiago’s money and tells the soldiers that Santiago is a powerful alchemist who will turn into wind within three days. Santiago feels alarmed because he has no idea how to turn into the wind, and over the next three days he contemplates the desert. On the third day, he communicates with the wind and the sun and coaxes them to help him create a tremendous sandstorm. He prays to the Hand That Wrote All, and at the height of the storm he disappears. He reappears on the other side of the camp, and the tribesmen, awed by the power of the storm and by Santiago’s ability, let him and the alchemist go free.
The alchemist continues to travel with Santiago as far as a Coptic monastery several hours from the pyramids. There, he demonstrates to Santiago his ability to turn lead into gold using the Philosopher’s Stone. He gives Santiago gold and sends him off. Santiago begins digging for the treasure at the foot of the pyramids, but two men accost him and beat him. When Santiago speaks to them about his dream vision, they decide he must have no money and let him live. Before leaving, one of the men tries to illustrate the worthlessness of dreams by telling Santiago about his own dream. It concerns a treasure buried in an abandoned church in Spain where a sycamore tree grows. The church is the same one in which Santiago had his original dream, and he finally understands where his treasure is. He returns to Spain to find a chest of jewels and gold buried under the tree, and plans to return with it to Al-Fayoum, where he will reunite with Fatima, who awaits him.