In the Nevada desert, a couple, Peter and Mary Jackson are driving just as they are stopped by a sheriff, Collie Entragian. He soon learns they are in possession of marijuana. In response, he takes them to jail. After they enter the police station, they see a little girl, dead, on the floor and Entragian shoots and kills Peter. Mary is thrown in a jail cell along with a young boy, David Carver, his parents, Ralph and Ellen, and an old man, Tom Billingsley. It's also learned the little girl is the Carver's daughter named Pie. In the meantime, in the police station, David is knelt down and prayed to God, which he's been doing since his best friend Brian was struck by a drunk driver.
Meanwhile, Steve Ames is in his truck following famous author Johnny Marinville who is some 50 miles up ahead. Steve soon picks up a young female hitchhiker named Cynthia Smith. Johnny stops in the desert to urinate just as Entragian shows up behind him and puts the same bag of marijuana he got from Peter and Mary in Johnny's motorcycle bag and "arrests" him. Back in the Police Station, David was asked by his mother Ellen why he kept on praying. David revealed that he prays to God because he made his presence known to him by miraculously saving his friend, Brian from the brink of death. He then recollected that when he and Brian(his friend) were riding a bike, a drunk driver hit Brian. The impact caused Brian to fly in the air and hit his head on a brick wall. Brian suffered severe head trauma and injuries to his face. David immediately began praying to God, offering to sacrifice anything, and to do what ever is asked of him just for his friend (Brian) to be saved. At which point, Brian, who was on the brink of death, miraculously regains consciousness. The doctor at the hospital describes Brian's recovery as "miraculous".
Later, David realizes Entragian's skin is breaking out and he keeps saying "Tak" because he is possessed. Entragian then takes Ellen so he can shift his spirit into her body and puts a vicious dog in charge of things. Pie's ghost appears and gives David a bar of soap. He proceeds to scrub his body with the soap and while the dog is distracted, David slips through the bars of the jail cell and gets out of the room. David searches the police station and finds a gun on the corpse of another sheriff. He returns to shoot the guarding dog to free everyone.
Meanwhile, Steve drives up to where Johnny was captured by Entragian to find Johnny's motorcycle hidden behind dry bushes. Cynthia and Steve later search the town of Desperation, where they find all the residents dead. That night, they both meet up with the gang. They gather at a theater and Tom tells a story that took place 120 years ago, when Chinese workers digging in a mine discovered an evil spirit named "Tak". The now possessed Ellen sends in a mountain lion and Tom is killed. Mary is captured by Ellen so that she can have a new body.
David sees the ghost of Pie in the theater again and she leads him to the movie editing machine revealing the truth of how Tak came to the town. Mary wakes up to find herself trapped in a shed waiting to be the next host for Tak. With the help of Pie, she manages to escape, while seriously injuring Ellen's body forcing Tak to take over the body of a buzzard.
Johnny later confesses 40 years ago in Vietnam he saw a guy, possessed by Tak, blow up the bathroom of a bar killing 87 people. Johnny still feels guilty to this day that he did not warn any of the patrons before fleeing the bar. The group decides to return to the cave with some explosives they found to put an end to Tak. At the entrance, the buzzard comes out and kills Ralph. In order to redeem himself, Johnny goes into the mine and falls in a hole leading to a small hole where Tak is. Johnny ignites the explosives, blowing up the mine while the rest of survivors drive away in Steve's truck.
Along the route driving away from the town, they pass by the RV vehicle owned by David's family and Peter's sister's car. Mary tells Steve to stop the truck to retrieve an overnight case from the car. In the back seat Mary finds an album belonging to David with a frontispiece picture of Johnny and Pie together, which Steve identifies as being signed by Johnny.
Who is the girl lying dead on the floor of the police station?
Carver's daughter named Pie