In the Prologue, the alchemist reads a story about Narcissus—a youth so fascinated by his own beautiful reflection that he falls into a lake and drowns. In this version of the story, the goddess of the forest encounters the lake in which Narcissus drowned. The lake is weeping, and the goddess assumes that the lake misses Narcissus’s beauty. However, the lake reveals that, actually, it’s weeping because it misses being able to admire its own beautiful reflection in Narcissus’s eyes. “What a lovely story,” the alchemist thinks.
In Part One of the novel, Santiago passes the night with his flock of sheep in an abandoned church. That night, he has a recurring dream. When he wakes, he looks forward to the village he will reach in four days where, the year before, he met a girl, the daughter of a merchant. Meeting her made him wish, for the first time in his life, that he could remain in one place. Santiago loves to travel, and became a shepherd, rather than a priest as his family had wanted, because his father told him that, among poor folk, only shepherds had the opportunity to travel.
A few days before reaching the merchant’s daughter’s village, Santiago encounters a fortune-teller, whom he hopes will be able to interpret his recurring dream. In the dream, a child transports Santiago to the Pyramids of Egypt and promises he will find hidden treasure there, but Santiago always wakes up just as the child is about to reveal it. After making Santiago promise to give her one-tenth of the treasure as payment, the fortuneteller interprets the dream to mean that if Santiago journeys to the pyramids, he’ll find hidden treasure.
Annoyed that he could have come to this interpretation on his own, Santiago leaves, and soon sits down in the plaza to read his book. An old man sits down next to him and says that it’s an important book, but that it contains the world’s greatest lie: that we do not control what happens to us. The old man introduces himself as Melchizedek, the King of Salem, and adds that if Santiago gives him one-tenth of this sheep, he will tell Santiago how to find his treasure. Santiago wonders if the old man and the fortune-teller are working together to rob him, but gives up his suspicions when Melchizedek demonstrates knowledge of things about Santiago’s life he couldn’t possibly know. Melchizedek explains that Santiago has discovered his Personal Legend – the thing a person has always wanted to accomplish. Each person knows what it is when he is young, but loses track of it as he ages. Melchizedek says that he appears to people in moments when they are about to give up on their Personal Legends.
The next day, Santiago meets Melchizedek and gives him six sheep. He sells his other sheep to a friend who dreamed of becoming a shepherd. Melchizedek says that to find his treasure, Santiago will have to follow the omens God reveals to him. Melchizedek gives Santiago two stones, called Urim and Thummin, which can be used for fortune telling. But he cautions Santiago also to rely on his own decisions.
Santiago arrives in Morocco, but quickly gets robbed and winds up sleeping in a marketplace. Eventually, Santiago wanders into a crystal shop and asks the crystal merchant for a job in exchange for something to eat. After Santiago cleans crystal all day, the merchant gives him dinner. Santiago is crushed when he learns that he would have to work for years to earn enough money to travel to the Pyramids, but he decides to work for the merchant in order to earn money to buy some sheep.
As Part Two of the novel opens, Santiago is working for the crystal merchant. He wants to build a display case to draw more attention to the store, but the merchant resists. The merchant doesn’t like change, and explains that he has always been an observant Muslim, but has never made a pilgrimage to Mecca. Though he could now, finally, afford the trip, he still puts it off because he fears not having something to look forward to in his future. He doesn’t want to realize his dream; he just wants to dream. But he does give Santiago permission to build the display case.
Business at the shop increases. Santiago is pleased that he is working toward his goal of acquiring an even larger flock of sheep. He has also earned to recognize omens: when he sees a man out of breath after climbing the hill to the shop, he realizes they should sell tea in the crystal they are selling. The merchant knows that this will change the nature of the business, but he feels he cannot resist the inevitable, or as he says “maktub,” meaning “it is written.” He sees Santiago’s appearance in his life as both a blessing and a curse. Santiago saved his business, but also showed him what his business was capable of, meaning he can never again be content with the simple business he had.
Soon Santiago has enough money to buy a large herd of sheep, but before doing so he happens upon Urim and Thummin in his old shepherd’s bag and decides instead to pursue his treasure. He suddenly feels tremendously happy, and finds a caravan crossing the desert. As he waits for the caravan to leave, Santiago meets an Englishman who tells him that there is a universal language understood by everybody. He says he is in search of that language, and hopes to find an alchemist in the desert who can teach him more.
As the caravan travels to the desert oasis of Al-Fayoum, Santiago becomes friends with a camel driver who used to be a farmer before his land was flooded. The camel driver says that disaster taught him to understand that many people are afraid of losing what they have, but this fear is no longer relevant when you understand that human lives were written by the same hand that created the world. He also advises Santiago that if you can concentrate on the present, you'll be happy. Meanwhile, the Englishman tells Santiago of a common principle that connects all things – the Soul of the World – and lends Santiago some books about the Master Work of alchemy: an Emerald Tablet, on which was written the secret to creating the Philosopher’s Stone, which could turn lead into gold, and the Elixir of Life, which granted mortality.
The caravan arrives safely at the oasis, which is the size of a large city. The oasis is neutral in the constant wars of the surrounding tribes, and no one can carry weapons there. Santiago helps the Englishman search for the alchemist, but with little luck. At one point, Santiago approaches a young woman to ask about the alchemist and suddenly he feels the Soul of the World. Immediately he realizes that the universal language is love. He meets with the woman, Fatima, day after day, and tells her of his quest for his treasure and how it has brought him to her. Eventually, Fatima tells Santiago that she has learned about omens from his stories, and that because of this learning she wants Santiago to continue toward his goal and pursue his dream. Fatima says "maktub," and tells Santiago that if they are really meant to be together, then he'll return to her one day.
One day as he walks in the desert, Santiago sees a hawk attack another and has a vision of an army attacking the oasis. Santiago goes to the tribal chieftains of the oasis to warn them. The chieftains respond that the next day the men of the oasis will break the agreement of the oasis and carry arms — if Santiago’s warning proves true he will be rewarded; but if it does not, he will lose his life.
Santiago leaves the chieftains’ tent upset, when suddenly a strange man on horseback confronts him. Santiago embraces the possibility of his own death and is not afraid. The stranger then reveals this was a test of Santiago's courage, which is essential when one wants to understand the Language of the World. Santiago has met the alchemist.
The next day, Santiago’s prophecy is fulfilled and the oasis is attacked, but the inhabitants of the oasis are ready to defend themselves. Santiago receives his reward: fifty pieces of gold. Soon after, the alchemist takes Santiago out into the desert to test whether he can find life in the desert. Santiago allows his horse to lead them, and the find a snake –the alchemist agrees to guide Santiago across the desert. Santiago wants to stay at the oasis because of Fatima, but the alchemist explains that if he stays, he will be haunted by the loss of his opportunity to find his treasure.
As they travel in the desert, the alchemist explains that the Emerald Tablet is a direct link to the Soul of the World. In the early times, everything about the Master Work could be written on the Emerald Tablet. But men rejected simple things. The alchemist directs Santiago back toward this simplicity, and says that Santiago should listen to his heart, because it came from the Soul of the World. Santiago practices listening to his heart, and comes to understand his heart’s changes and contradictions, and that people are afraid to pursue their most important dreams because they know they will suffer if they don’t succeed.
Not long after, Santiago and the alchemist are taken prisoner by one of the warring tribes. Soon they are brought before the enemy chieftain, who thinks that they’re spies. The alchemist responds that Santiago is an alchemist who can turn himself into the wind, and says that if Santiago has not turned himself into the wind in three days time, the chieftain can kill them. The chieftain agrees.
Once they’re alone, Santiago protests that he has no idea how to turn himself into the wind, but the alchemist responds that when a person is living out his Personal Legend, he has all the tools he needs—the only thing that could hold him back is the fear of failure. He adds that if Santiago does not succeed, then at least he’ll die while trying to realize his Personal Legend.
On the first and second days, Santiago is at a loss. On the third day, the enemy chieftain has Santiago go up to a cliff above the enemy camp. Santiago appeals to the desert, the wind, and the sun to help him, but none of them are able. The sun recommends that Santiago speak directly to the “hand that wrote all,” though, and Santiago reaches through the Soul of the World and discovers the Soul of God. He sees the oneness between his own soul and the Soul of God and, because of this oneness, realizes that he has the ability to perform miracles. Santiago turns himself into the wind, creating a terrible windstorm. The tribesmen are terrified, but the alchemist is happy to have found such an ideal student, and the enemy chieftain is pleased to have witnessed the glory of Allah. The next day, Santiago and the alchemist leave the camp with an honor guard.
Eventually they reach a Coptic monastery, where a monk welcomes them inside to rest. While there, the alchemist uses the Philosopher’s Stone to change lead into gold. He gives a quarter of the gold to the monk for his hospitality, a quarter to Santiago to repay him for the amount taken by the enemy chieftain, and quarter for himself. The final quarter he gives to the monk, saying that it is for Santiago if he ever needs it. The alchemist tells Santiago everyone on earth plays an important role, even if he doesn't know it. Then the alchemist bids Santiago farewell.
Santiago rides alone through the desert, listening to his heart, which tells him that he will find his treasure at the place where he is brought to tears. At the top of a dune, Santiago sees the Egyptian pyramids before him. He falls to his knees and cries out in thanks to God for making him follow his Personal Legend. Remembering the words of his heart, Santiago digs in the place he fell to his knees crying.
As he digs, several people approach Santiago. They are desperate refugees from the tribal wars, and they beat Santiago and take the gold given to him by the alchemist. When Santiago tells them he is looking for treasure at that place, the leader of the refugees says he’s being stupid. The leader adds that two years earlier he himself had a recurring dream in which he saw an abandoned church that sheltered shepherds and sheep. The dream told him that if he dug at the roots of the tree growing through the center of the church, he would find a hidden treasure. But he never went in search of the treasure, because it was just a dream. After the refugees have left, Santiago laughs aloud, because now he knows the location of his treasure.
In the Epilogue, Santiago reaches the abandoned church where his story began. He thinks of the strangeness of the path that God has led him on, but is grateful for the people he has met along the way. He soon uncovers a chest of gold and jewels. The wind begins to blow, and it brings with it a familiar scent of perfume. Santiago smiles and says, “I’m coming, Fatima.”