The Enterprise takes a team of historians to the planet of the time vortex inhabited by the Guardian of Forever. Kirk, Spock, and Historian Erikson return from an observation mission to Orion at the dawn of its civilization. Spock is the last to return through the portal... and a confused McCoy has no idea who Spock is. They beam up to the Enterprise where Scotty has no idea who Spock is either. Kirk is surprised to find that he has a new First Office: Thelin, an Andorian who has served aboard the Enterprise for five years. Kirk and Spock quickly conclude it's not a prank and something has altered history. Erikson checks everything they did in the past but can't find anything that would have eliminated Spock from the timeline. Starfleet records show that there is no Spock serving in Starfleet. However, the records show that Sarek of Vulcan and his wife Amanda separated after the death of their son, and she was killed in a shuttle accident on the way home. The son was named Spock and died at the age of seven.
The team determines that the other historians were using the Guardian while they were in Orion's past, and scanning Vulcan's past. They recorded Spock as dying during a maturity test, the kahs-wan, a traditional survival test. Spock is aware of the date and remembers it as the day his cousin Selek saved his life in the desert when he was attacked by a wild animal. Spock never saw Selek after that, and realizes that "Selek" looked like him. They conclude that Spock that saved himself in the past, but wasn't present to go back in time when the historians scanned Vulcan history. When he failed to go back in time, Young Spock died in the past, eliminating Spock from the timeline. The Guardian of Forever confirms that Spock can go back and repair the timeline if no other major factor is changed. Spock warns that he doesn't remember everything that happened. Spock requisitions the necessary clothing and gear. Thelin expresses his condolences and is satisfied that Spock will have his family back.
Spock specifies the coordinates and departs for the city of ShirKahr. He finds himself in the desert outside the city and enters the community. he goes to his family home and witnesses several young Vulcans taunting the half-Vulcan Spock in the streets. Spock tries to fight back, using the Vulcan nerve pinch without success, and the boys depart. Sarek arrives and apologizes for his son's emotional outburst. Spock identifies himself as Selek, a distant cousin journeying to the family shrine. Sarek offers the hospitality of his home and briefly seems to recognize Spock. They go inside where Young Spock is with his pet sehlat, a large bear-like creature. Sarek lectures him on Vulcan philosophy, while Amanda approaches Spock and offers her apologies for her son's behavior. Spock he can understand Young Spock's viewpoint and is sure he will prevail. When Spock asks about the kahs-wan, Amanda says Young Spock will go through it... in a month. Spock is startled, recalling the test occurred the next day. Meanwhile, Sarek explains the ritual to Young Spock, noting that it isn't a disgrace to fail... for others. He tells Young Spock he doesn't expect him to fail and refuses to consider anything else. Spock turns to his sehlat, I-Chaya, and wonders what will happen if he fails.
Spock goes over his memories in private and is sure that his trial took place the next day. He's unaware that Young Spock is sneaking out on his own. The boy orders I-Chaya to remain behind but it trails after Young Spock as he goes out into the desert. Spock remembers that what he underwent wasn't the actual ritual but a personal test. In the desert, Young Spock orders the aging I-Chaya to go back home but has no success. Spock follows his younger self into the mountains, realizing the ordeal would determine the course his life would take. Back at Sarek's home, the couple realize Young Spock and Spock are both gone. Sarek still wonders at Spock's seeming familiarity and calls the authorities to begin a search.
In the desert, a dragon-like le-matya attacks Young Spock, I-Chaya intervenes and holds off the beast, and Spock arrives to render it unconscious with a Vulcan nerve pinch. Young Spock thanks him and Spock assures him he'll one day master the nerve pinch. As they return to the city, Young Spock wonders why Spock followed him. He insists that it was a personal test and he couldn't fail his parents. Young Spock wonders about his mother's emotional traits and Spock explains that they confuse them because he sees them in himself. Spock explains that Vulcans control emotions through logic, rather than lacking emotions. They're interrupted when I-Chaya collapses. The le-matya claws are poisoned and the poison is killing the pet. Spock has no memory of I-Chaya dying in his timeline. He tells Young Spock he needs to go to the city to find a healer and warns there are many dangers. Young Spock insists it is his duty and asks Spock to remain with the sehlat. Spock tries to console his former pet while Young Spock runs through the desert, narrowly avoiding a carnivorous plant.
Arriving in the city, he goes to the healer, who suspects the half-human Spock is playing a prank. Young Spock admits he once did but the need is urgent and he has never been called a liar. The healer agrees to take a hovercar out into the desert with him. They arrive and after an examination, the healer informs Young Spock that there's no hope for I-Chaya. However, Young Spock can choose to end his life or prolong it without pain. Spock assures the boy that his pet's life wasn't wasted and Young Spock tells the healer to end I-Chaya's life. Back in the city, Young Spock apologizes for troubling them and says it was necessary to help him make his decision to choose Vulcan. Sarek is satisfied and Young Spock goes to demonstrate the newly learned Vulcan neck pinch on his bullying schoolmates. Spock makes his farewells and Sarek thanks him for saving Young Spock. Spock asks only that he try to understand his son and says that he will not pass this way again.
Spock returns through the Guardian of Forever and upon beaming up to the Enterprise, they discover that the timeline is restored and everyone remembers Spock. McCoy is ready to finish the crew physicals, and Spock notes that if the times were different, he'd have to recalibrate his instruments for an Andorian. McCoy is not amused by the seeming joke.