As All the Pretty Horses begins, John Grady Cole’s grandfather has just died, and he’s learned that the San Angelo, Texas ranch that has been in his family for generations is about to be sold. The ranch is in his mother’s name, and she doesn’t want any part in it anymore. John Grady first tries to convince his father to change her mind, but his father, who hasn’t been quite the same since his return from a POW camp in World War II, says there’s nothing he can do. Mr. Franklin, the lawyer, tells him the same thing—as a sixteen-year-old, John Grady can’t take it over. Mr. Franklin also tells him his parents have recently finalized their divorce. John Grady buys a ticket to San Antonio, where he watches his mother perform on a stage, and then waits for her at a hotel lobby, where he sees her with another man. John Grady goes to see his old friend Lacey Rawlins, and they talk about leaving for Mexico. Before leaving, John Grady sees Mary Catherine Barnett, a girl who has recently dumped him, one last time.
John and Lacey leave early in the morning and as they approach the border with Mexico, a young boy who appears to have been following them catches up. He calls himself Jimmy Blevins, but they doubt it’s his real name, as it’s also the name of a religious radio host. Blevins admits he’s run away from home. He’s riding a beautiful bay horse, which the boys think may be stolen. Rawlins doesn’t want anything to do with him. They separate, but end up running into each other again at the river dividing the U.S. and Mexico. That night, there’s a thunderstorm, and Blevins, who is deathly afraid of lightning, hides in a river and ends up losing both his horse and all his clothes. Against Rawlins’ protestations, John Grady lifts him onto the back of his own horse.
They soon reach the town of Encantada in Mexico, where John Grady and Rawlins see Blevins’ horse tied in a mud barn behind one of the houses. Though Rawlins protests again, they make a plan to take back the horse early the next morning. The plan soon goes awry, as a pack of barking dogs wakes the entire town up, and Blevins risks all their lives in making sure he gets his saddle in addition to his horse. Knowing that riders are following them, the three separate, with John Grady and Rawlins heading off the road.
The pair ask people along the way where they can find work, and eventually they end up at the Hacienda de Nuestra Señora de la Purísima Concepción, a ranch owned by Don Héctor Rocha y Villareal. They’re hired to take care of the cattle, though after a few days they ask the gerente (manager) if they can attempt to break or tame—in four days—the sixteen wild mares that have been captured. As they work, a crowd of townspeople gathers around them. They succeed, and as a result Don Hector gives John Grady a more important task: that of breeding mares.
Don Hector invites John Grady to play billiards with him and he discusses horses. Meanwhile, John Grady has caught the attention of Don Hector’s daughter Alejandra, a beautiful teenager whom he dances with at a town dance in La Vega. They begin to ride horses together, but Alejandra’s great-aunt, Alfonsa, warns John Grady that a woman in Mexico has nothing other than her honor. Nevertheless, Alejandra comes to John Grady’s bunkhouse that night, and they begin to sleep together. One night he and Rawlins are on the mesa when they see a pack of greyhounds. They believe someone is hunting them, and worry that Don Hector may have found out about John Grady and his daughter. The next morning, policeman break into the bunkhouse and arrest them.
They ride off with the officers for several days into an unknown town, where they’re placed in a mud cell that also houses Blevins. It turns out that Blevins had worked for a few months before returning to Encantada to retrieve his pistol. He’d gotten into a gunfight and killed a man. The captain, a Mexican official, brings John Grady and Rawlins into his office, one by one, and tortures them, trying to make them confess that they committed crimes with Blevins and that they aren’t who they say they are. A few days later, the three of them are taken out of the cell and onto a truck with the captain and a few other guards. They pick up another man, the charro (cowboy), and head towards the prison in Saltillo. At one point, however, they make a detour into an abandoned hacienda. The captain and charro take Blevins, who seems terrified, out of the truck, and Blevins thrusts his remaining pesos at John Grady and Rawlins. He’s taken into the woods, and they hear the pop of a pistol.
John Grady and Rawlins are taken to a vast prison in Saltillo, where for the first three days they’re constantly in fistfights. After that, they’re taken into the cell of Pérez, a prisoner who seems to be in a position of great power, able to arrange bribes to get them out. John Grady and Rawlins deny that they have any money and leave. Soon afterward, Rawlins is stabbed in the stomach, and led out of the prison yard by Pérez’s men. John Grady buys a switchblade from another prisoner. A few days later, he’s in the mess hall when a young cuchillero begins to fight him, apparently to the death. John Grady is wounded, and as the cuchillero prepares to slit John Grady’s throat, John Grady stabs him in the heart. One of Pérez’s men carries him, weak and bleeding, out of the yard. When he regains consciousness, he’s in a black room.
Over the next few days, several men come in and out. Finally, he’s sent to meet Pérez, who hands him an envelope full of money. Apparently, Alfonsa has paid to have him and Rawlins freed. John Grady wants to go back to the hacienda to find Alejandra, but Rawlins buys a ticket back to Texas. When John Grady arrives, it turns out that it was as he had feared: Alfonsa had paid for John Grady’s release in return for Alejandra’s vow not to continue her affair with him. Alfonsa begins a long monologue, telling John Grady about her adolescence as a radical, free-thinking young woman whose close friendship with the political revolutionaries Francisco and Gustavo Madero caused her father to exile her to Europe. She tells John Grady about the devastating brutality and violence of the revolution, about how all their ideals turned into bloodshed. She says that his only excuse is that things happened outside his control, which is not a good reason for her to be on his side. Alfonsa relates several anecdotes about destiny and responsibility. Her own thoughts on fate seem ambivalent, though she says she believes it is human nature to want to place responsibility on someone or something.
John Grady still decides to pursue Alejandra and convince her to stay with him. He calls her from another town, Torreón, and she agrees to meet him at Zacatecas. They spend a day and a night together, but at the end, she tells him she cannot break her word to Alfonsa; in addition, she has seen how her father’s love for her, which she thought was unbreakable, is in fact not so, and she can’t stand to see it unravel further. After she leaves, John Grady is devastated. But he has a final task in Mexico: retrieve his and Rawlins’ horses.
He returns to Encantada and forces the captain and charro, at gunpoint, to lead him to the horses. They bring him to an hacienda where he finds both horses and also Blevins’. Two men at the hacienda figure out what’s going on and they exchange fire. John Grady is shot in the leg, but he’s able to escape with the horses, and takes the captain hostage with him. They spend several days and nights riding. At one point, John Grady cauterizes his wound with a red-hot pistol barrel to prevent infection. He wakes up one morning to find a group of Mexicans taking the captain away in handcuffs.
When John Grady reaches the border, he spends several weeks attempting to find the owner of Blevins’ horse. He finally gives up and hands it over to the county. He tells the judge his story at the hearing, and the judge is impressed by John Grady’s actions. Later that night, John Grady shows up at the judge’s house, wanting to confess that there’s much he’s done that he isn’t proud of, and how guilty he feels. Finally, John Grady returns to San Angelo, where he returns Rawlins’ horse, and they have a short conversation. It seems that they’re not as comfortable with each other as they once were. John Grady’s father has died, and as the novel ends, he is heading out to Mexico again.