Harry Potter and his cousin Dudley Dursley are attacked by Dementors, but Harry drives them off with a Patronus charm. The Ministry of Magic detects the underage wizardry and expels Harry from Hogwarts, but this is modified to a trial later in the summer. Harry is later awoken by the arrival of a number of wizards who escort him to the headquarters of the Order of the Phoenix, a secret organisation founded by Dumbledore. Harry learns that under the Ministry's influence The Daily Prophet has launched a campaign against anyone who claims that Lord Voldemort has returned.
Harry and Arthur Weasley head to the court for Harry's trial. With the help of Dumbledore and Harry's neighbour, Mrs. Figg, Harry is cleared of all charges and returns to school. Upon arrival, Harry sees creatures pulling the carriages to Hogwarts. Harry, Ron, Hermione, and Neville share a carriage with Luna Lovegood, an odd but kind girl who claims she can also see the creatures. The Minister of Magic Cornelius Fudge appoints a new Defense Against the Dark Arts teacher, Dolores Umbridge, a senior Ministry official who refuses to teach practical magic, as the Ministry fears Dumbledore will organise his own wizard army. For claiming Voldemort has returned, Harry is forced to write, "I must not tell lies," repeatedly in his own blood, creating a scar on his hand.
Harry sees Luna in the forest with the creatures that pulled the Hogwarts carriages. She tells him that they are called Thestrals and can only be seen by those who have seen death. Luna mentions that the Thestrals are very gentle, but people avoid them because of their evil looks.
As Umbridge's control over the school increases, Ron and Hermione aid Harry in forming a secret group to train students in defensive spells, calling themselves "Dumbledore's Army" or D.A. The Slytherin students are recruited by Umbridge to uncover the group. Meanwhile, Harry and Cho develop romantic feelings for each other.
Harry has a nightmare involving an attack upon Arthur Weasley in the Department of Mysteries that echoes an actual attack. Fearing Voldemort will exploit his connection to Harry, Dumbledore instructs Professor Snape to give Harry Occlumency lessons to block his mind from Voldemort's influence.
Bellatrix Lestrange, Sirius Black's deranged cousin, escapes from Azkaban along with nine other Death Eaters. At Hogwarts Umbridge, Filch and her Inquisitorial Squad uncover Dumbledore's Army after interrogating Cho. Dumbledore is questioned and escapes as Fudge orders his arrest. With Dumbledore gone, Umbridge becomes the new Headmistress.
With Hagrid likely to be fired due to Umbridge's prejudice against "half-breeds", he shows Harry, Ron and Hermione Grawp, his Giant half-brother. Hagrid asks them to take care of Grawp if anything happens to him.
During an exam the Weasley twins revolt and set off fireworks in the Great Hall, causing chaos for Umbridge. Harry has a vision of Sirius being tortured by Voldemort within the Department of Mysteries. Harry, Ron, and Hermione rush to search for Sirius, but Umbridge catches them and begins interrogating Harry. Hermione deceives Umbridge into entering the Forbidden Forest along with Harry and her in search of a weapon, leading her to the hiding place of Grawp only to find him missing. Centaurs, who have their own issues with the Ministry, emerge and carry the Headmistress into the darkness after she attacks them. Harry, Hermione, Ron, Luna, Neville and Ginny fly to the Ministry of Magic on the Thestrals' backs to save Sirius.
The six enter the Department of Mysteries, where they uncover a prophecy involving Harry and Voldemort, but are ambushed by Death Eaters including Lucius Malfoy and Bellatrix Lestrange. Lucius reveals that Sirius isn't in any danger and that Harry only saw what Voldemort wanted him to see. Lucius attempts to persuade Harry to give him the prophecy, telling him it will reveal why Voldemort tried to kill him when he was an infant. Harry refuses and a fight between the D.A. and the Death Eaters ensues. The Death Eaters take everyone except Harry as hostages, threatening to kill them if he does not surrender the prophecy. The Order of the Phoenix appears and attacks the Death Eaters. Lucius drops the prophecy, destroying it. A battle erupts and Bellatrix kills Sirius. Harry corners Bellatrix in the Atrium and attempts to torture her with the Cruciatus Curse, but to no avail. Voldemort appears, tempting Harry to give in to his hatred for Bellatrix. Harry turns his wand on Voldemort who disarms him. Before Voldemort can kill Harry, Dumbledore emerges.
A duel between Voldemort and Dumbledore ensues. After it ends in a stalemate Voldemort attempts to possess Harry but is repelled by the love Harry has for his friends and Sirius. Ministry officials arrive via the Floo Network moments before Voldemort disapparates. Fudge is forced to admit that Voldemort has returned. Harry is vindicated, Umbridge is suspended, and Dumbledore returns as headmaster.
Dumbledore explains that he distanced himself from Harry all year hoping it would lessen the risk of Voldemort using their connection. Harry comes to terms with the prophecy; he or Voldemort will kill the other. Going home for the summer, Harry tells his friends that they have one thing Voldemort does not have: love, something worth fighting for.