The crew of the Enterprise, along with a team of historians that includes a member that looks like a gryphon, is researching the history of the Federation using something referred to as the "timevortex", the focus of all the timelines of the galaxy. (possibly the same one encountered in The City on the Edge of Forever (TOS)) Kirk and Spock return the present after observing the beginnings of the civilization of Orion, but no one recognizes Spock. Despite their best efforts, it looks like the timeline has been altered.

Once aboard the Enterprise, Kirk finds that the first officer is not Spock, but an Andorian named Thalin. Research into Spock's past shows that, in this timeline, he died at the age of 7. Upon return to the planet, Kirk asks the historians if the "guardian" of the time vortex was in use while he and Spock were on Orion. The historians tell him that they were, in fact, researching recent Vulcan history.

Spock asks them if there was any record of his death. They tell him that there was indeed such a record, stating that he died during a Vulcan maturity test. Spock recalls that a cousin by the name of Selak saved his life during that test. Kirk asks him if Selak looked anything like he did in the present. Spock confirms this. At that point it is revealed that Selak was, in fact, Spock. They come to the conclusion that, since Spock was on Orion when the time vortex guardian "replayed" the part of the timeline that the historians were researching, he couldn't have gone back in time to save himself as a child, so he died. The solution, of couse, is for Spock to go back in time and save himself.

He then goes through the time vortex and arrives in his hometown on Vulcan, 30 Vulcan years before the present. There he witnesses his younger self in the midst of an embarassing show of emotion. He then travels to his old home, along with Sarek and his younger self. Sarek tells the young Spock that he will soon have to go through the "Koswan Ordeal", a test of maturity whereby the subject is sent to survive in the Vulcan desert for 10 days without food or water. He doubts he can pass this test, so that night, he sets out into the desert to prove to himself that he can do it.

This is exactly what Spock knows is supposed to happen, but with one exception: Sarek and young Spock's pet Selat runs out after him. Later, it confronts the Lamatcha that is supposed to attack and kill young Spock. The present Spock (who has identified himself as Selak) jumps on the Lamatcha and subdues it with a Vulcan Nerve Pinch, but not before it strikes the Selat with it's poisonous claw. Young Spock runs to a nearby city and asks a healer there for help reviving his poisoned pet. Upon their arrival, the healer states that too much time has passed, and suggests that the Selat be euthanised.

That small difference aside, Spock has successfully repaired the timeline, so he returns to the present. Aboard the Enterprise, Bones makes a comment about how he had to reconfigure his equipment to perform a physical examination on a Vulcan. Spock remarks that, in different times, he would have had to reconfigure it for an Andorian.

There is a connection of sorts between the universe of Enterprise and that of TAS made in this episode. After meeting Sarek on Vulcan, Spock identifies himself as "Selak, a cousin, descendant of T'pol and Asasak."

Now, it's possible that the T'pol he refers to is entirely different from the Subcommander T'pol serving aboard the NX-01, but I'm under the impression that every Vulcan name is used only once, at least within a given generation. It is also possible that this genealogy is, just as the name Selak, completely false. Another possibility, far more intruiging than the others, is that T'pol is a close blood relative to Spock, possibly even his aunt.