After finding the underground entrance to the Chamber of Secrets, Harry, Ron, and Professor Gilderoy Lockhart jump into it. Scared out of his wits, Lockhart tries to bluff his way out and put a spell of memory loss on Harry and Ron, but the spell backfires and Lockhart loses his own memory. Harry enters into the inner chamber where he finds Ginny Weasley lying on the floor. Tom Riddle describes how he got Ginny to open the Chamber, write the words on the wall, and then plant the diary where Harry could find it. As Ginny grows weaker, he says, he is growing stronger and will soon be able to inhabit a corporeal body. Of course, Ginny will die. When Harry asks who he really is, Tom shows how his name Tom Marvolo Riddle can be anagrammed to read I am Lord Voldemort. Tom/Voldemort then releases the basilisk to kill Harry, but Dumbledore's phoenix Fawkes suddenly flies through the Chamber. He pecks out the basilisk's eyes so that it cannot turn Harry to stone with its glance. He also gives Harry a sorcerer's hat in which a Gryffindor sword appears. Harry defeats the basilisk by driving the sword through the roof of its mouth. Unfortunately, the basilisk managed to bite Harry during their fight. As Voldemort gloats, Harry takes one of the basilisk's broken fangs and drives it through the diary. As Voldemort has still not fully manifested, the venom causes his "preservation" to explode. Ginny wakes up. Fawkes cries healing tears into Harry's wound.
Dumbledore returns to Hogwarts, signs release papers for Hagrid, and awards Ron and Harry for their special service to the school. He also explains to Harry that, when Voldemort put the lightning scar on Harry's forehead, he unintentionally transferred some of his powers into Harry, which explains why Harry can speak Parceltongue. Suddenly, Lucius Malfoy enters the room with his House Elf Dobby in tow. Figuring that Harry has finally been fingered as the culprit who opened the Chamber, he is surprised to hear Dumbledore blame it on Voldemort. Angrily, Lucius storms out of Dumbledore's office. Harry runs after him to give him back the diary, which Lucius had surreptitiously slipped into Ginny's cauldron. When Lucius tries to deny it, he gives the diary to Dobby, who opens it to find a black sock. "Master has given Dobby a sock!" Dobby cries. "Dobby is FREE!" Lucius, of course, is doubly angry at Harry for releasing his servant and tries to zap Harry with the Killing Curse, but Dobby steps between them and zaps Lucius across the room. Harry makes Dobby promise to never try to save his life again.
In the final scenes, Hermione, cured of petrification, joins Ron and Harry at the end of the year feast, and Hagrid returns just in time to thank them for getting him released from Azkaban.