Spock's death saving the Enterprise in The Wrath of Khan and his return through the Genesis planet and a Vulcan ritual in The Search for Spock.
In Star Trek II: The Wrath of Khan, Khan triggered the Genesis device in the Mutara Nebula while the damaged Enterprise could not escape. Spock went into the engine room, which was flooded with radiation, and restored warp power by hand. The ship escaped, but Spock died from the radiation after a final conversation with Kirk through the glass. Before entering, he had mind-melded with McCoy. His body was launched in a torpedo casing and landed on the new Genesis planet.
In Star Trek III: The Search for Spock, Sarek tells Kirk that Spock's katra, his living spirit, has been placed in McCoy. Kirk and his officers steal the Enterprise and go to Genesis, where the planet has regenerated Spock's body. After a fight with Kruge's Klingons, they bring the body to Vulcan.
On Mount Seleya, the high priestess T'Lar performs the fal-tor-pan ceremony and reunites Spock's katra with his body. Spock then begins relearning his past, a process that continues in Star Trek IV.