On November 12, 1955, moments after witnessing his apparent death, Marty McFly learns that Dr. Emmett Brown was transported to 1885. Marty and the 1955 Doc use the information in Doc's 1885 letter to find and repair the DeLorean so Marty can return to 1985; Doc's letter instructs Marty not to retrieve him. Marty spots and photographs a tombstone with Doc's name, dated six days after the letter, and learns Doc was killed by Biff Tannen's great-grandfather, Buford.
Marty travels to September 2, 1885 to save Doc. He arrives in the middle of a cavalry pursuit of Native Americans. When the DeLorean's fuel line is torn, Marty hides the car in a cave only to be chased by a bear and knocked out. Found by his Irish-born great-great-grandparents Seamus and Maggie McFly, he spends the night at their farm, then walks to Hill Valley and runs afoul of Buford and his gang. Buford attempts to lynch Marty, but Doc rescues him. Doc agrees to leave 1885 after seeing the photograph, but without gasoline, the DeLorean cannot reach 88 mph (142 km/h).
Doc devises a plan to use a steam locomotive to push the DeLorean up to the required speed. While he and Marty explore a rail spur, they spot a runaway horse-drawn wagon. Doc saves the passenger, Clara Clayton, altering her death from the original timeline, and they quickly fall in love. At a town festival, Buford tries shooting Doc, but Marty thwarts him. Buford insults Marty and challenges him to a showdown in two days; in his anger, Marty accepts. Doc warns Marty not to get provoked by name-calling and lets it slip that Marty gets into a car accident in the future. Doc's name in the photograph is erased but the date and tombstone itself remain.
After a failed attempt to convince Clara that he is from the future, Doc is spurned. He goes to the saloon for a binge and drinks a single shot of whiskey, causing him to pass out. In the morning, Buford arrives and calls out Marty, who observes the photograph and sees "Clint Eastwood" (his 1885 alias) appear on the tombstone, so refuses to duel. Doc awakens after drinking the bartender's special "Wake-Up Juice" and tries fleeing with Marty, but Buford's gang captures Doc, forcing Marty to duel. After fooling Buford into thinking he killed Marty, Marty knocks Buford into a wagon of manure, and Buford is arrested for an earlier robbery.
As Clara departs on the train for San Francisco, she overhears a salesman discussing how heartbroken Doc was at the saloon. Clara applies the emergency brake and returns on foot to Hill Valley. She discovers Doc's model of the time machine at his shop and, realizing he was telling her the truth, rides after him. Stealing the locomotive at gunpoint, Doc and Marty begin pushing the DeLorean along the spur line. Clara boards the locomotive while Doc climbs toward the DeLorean. Doc encourages Clara to join him, but she falls, hanging by her dress. Marty passes his hoverboard to Doc so he can save Clara. They coast away from the locomotive as it falls off an unfinished railroad bridge; Marty travels to 1985 on the now completed bridge.
Marty arrives on October 27, 1985, escaping the powerless DeLorean before it is destroyed by an oncoming train. He discovers the timeline has returned to normal, and finds Jennifer sleeping on her front porch. He uses the lessons he learned in 1885 to avoid being goaded into a street race with Douglas J. Needles, avoiding an automobile accident. Remembering that this accident would have sent Marty's life spiraling downward, Jennifer opens a fax message she kept from 2015 and watches as its text regarding Marty's firing disappears.
As Marty and Jennifer examine the DeLorean wreckage, a flying steam locomotive equipped with a flux capacitor appears, manned by Doc, Clara, and their two children Jules and Verne. Doc gives Marty a photo of the two of them by the clockworks in 1885. Jennifer asks about the fax, and Doc tells them it means that the future has not yet been written. Doc and his family say goodbye and depart aboard the locomotive, which takes flight before disappearing.
Michael J. Fox as Marty McFly / Seamus McFly
Christopher Lloyd as Emmett "Doc" Brown
Mary Steenburgen as Clara Clayton
Thomas F. Wilson as Buford "Mad Dog" Tannen / Biff Tannen
Lea Thompson as Maggie McFly / Lorraine Baines-McFly
James Tolkan as Marshal James Strickland
Matt Clark as Chester the Bartender
Elisabeth Shue as Jennifer Parker
Flea as Douglas J. Needles