All the Pretty Horses is the story of John Grady Cole, a young ranch hand traveling the country in search of work after his grandfather's death and the sale of his ranch. Grady's journey and travails, including incarceration in a Mexican prison, taking up with the possible outlaw Blevins, and an affair with a ranch owner's daughter, frame a narrative of isolation, romanticism, and crime. Blevins' bay horse, too fine for that young outlaw to own, is a constant symbolic presence in the narrative.
The novel tells of John Grady Cole, a 16-year-old who grew up on his grandfather's ranch in San Angelo, Texas. The boy was raised for a significant part of his youth, perhaps 15 of his 16 years, by a family of Mexican origin who worked on the ranch; he is a native speaker of Spanish and English. The story begins in 1949, soon after the death of John Grady's grandfather when Grady learns the ranch is to be sold. Faced with the prospect of moving into town, Grady instead chooses to leave and persuades his best friend, Lacey Rawlins, to accompany him. Traveling by horseback, the pair travels southward into Mexico, where they hope to find work as cowboys.
Shortly before they cross the Mexican border, they encounter a young man who says he is named Jimmy Blevins and who seems to be about 13 but claims to be older. Blevins' origins and the authenticity of his name are never quite clarified. Blevins rides a huge bay horse that is far too fine a specimen to be the property of a runaway boy, but Blevins insists it is his. As they travel south through a severe thunderstorm, Blevins' horse runs off, and he loses his pistol.
Blevins persuades John Grady and Rawlins to accompany him to the nearest town to find the horse and his distinctive vintage Colt pistol. They find both but have no way to prove Blevins' ownership. Against his companions' better judgment, Blevins steals back the horse. As the three are riding away from the town they are pursued, and Blevins separates from Rawlins and John Grady. The pursuers follow Blevins, and Rawlins and Grady escape.
Rawlins and John Grady travel farther south. In the fertile oasis region of Coahuila known as the Bolsón de Cuatro Ciénegas, they find employment at a large ranch. There, John Grady first encounters the ranch owner's beautiful daughter, Alejandra. As Rawlins pursues work with the ranch hands, John Grady's skill with horses catches the eye of the owner, who brings him into the ranch house and promotes him to a more responsible position as a horse trainer and breeder. At this time, John Grady begins an affair with Alejandra, which attracts the attention of Alejandra's great aunt, an intelligent and strong-willed widow who in her younger days defied social convention by being involved with Mexican revolutionaries. She tells John Grady about the consequences in Mexican society of a woman losing her honor, and how Alejandra can ill-afford to be seen in the presence of John Grady due to its potential impact on her reputation. The aunt recounts her own story of love and loss, and says, thoughit might seem she would be sympathetic to her own grandniece's desire, it, in fact, has the opposite impact; she opposes their involvement.
As John Grady and Alejandra secretly become more deeply involved, a group of Mexican Rangers visit the ranch and then ride off without explanation. Alejandra returns to Mexico City, where she is in school, and John Grady plans to ask her to admit her true feelings for him upon her return. When he confides this to a senior ranch hand who has been kind to him, John Grady is surprised to learn Alejandra has returned to the ranch without coming to see him.
Somewhat later, the Rangers return and arrest Rawlins and John Grady. They are brought to a dismal Mexican holding cell where they discover Blevins is also in custody. They learn Blevins had escaped his pursuers but subsequently returned to the village where he had recovered his horse, this time to retrieve the Colt pistol. In the process of getting the pistol, he shot and killed a man.
The three boys are interrogated and beaten, and a crooked police captain threatens them. While they are being transferred from their small jail to a larger prison, the captain and police officers detour to a remote ranch. Blevins is led off while Rawlins and John Grady watch powerlessly; then they hear gunshots as Blevins is executed.
The two friends are brought to the larger prison, where the inmates test the two boys by attacking them relentlessly over a period of days. They barely survive and try to figure out how to get out of prison; an inmate with special privileges, who seems to command the respect of the other inmates, takes an interest in their situation and suggests money might solve their problem. They decline this offer of protection, because they have no money and Rawlins is soon severely wounded by a knife-wielding inmate and is taken away; Grady is not sure if Rawlins has survived. Soon afterward, Grady is wounded while defending himself from a cuchillero and kills the man.
After a long recovery from his near-fatal stabbing, Grady is released and finds Rawlins has also survived and been freed. They discover that Alejandra's aunt has interceded to free them, but on the condition that Alejandra undertake never to see John Grady again.
Rawlins returns to the United States and John Grady tries to see Alejandra again. In the end, after a brief encounter, Alejandra decides she must keep her promise to her family and refuses John Grady's marriage proposal. John Grady, on his way back to Texas, kidnaps the captain at gunpoint, forces him to recover the horses and guns that were taken from him, Rawlins, and Blevins, and flees across the country. He is severely wounded in the escape and cauterizes a serious gunshot wound using his pistol barrel heated in a fire.
He considers killing the captain but encounters a group of Mexicans who call themselves "men of the country," who take the captain as a prisoner. John Grady eventually returns to Texas and spends months trying to find the owner of Blevins' horse. He gains legal possession of the horse in a court hearing where he recounts the entire story of his journey across the border, and the judge later tries to absolve Grady of his guilt both for killing the prisoner who attacked him and for being unable to prevent Blevins being murdered.
John Grady briefly reunites with Rawlins to return his horse and learns that his own father has died (something he has already intuited). After watching the burial procession of one of his family's lifelong employees (an elderly Mexican woman who had helped care for three generations of his family from their infancy), the last strong link to his family and his past, John Grady rides off into the West with Blevins's horse in tow.