A narrator explains how humans were unaware that a race of intelligent extraterrestrials were making plans to occupy Earth. Ray Ferrier is a divorced crane operator longshoreman who works at a dock in Brooklyn and lives in Bayonne, NJ. Ray is estranged from his children. His former wife, Mary Ann, later drops off the children, ten-year-old daughter Rachel and teenage son Robbie, at Ray's house in Bayonne on her way to visit her parents in Boston. Unexplained changes in the weather occur, including lightning that strikes multiple times in the middle of an intersection and disrupts all electricity.
Ray joins the crowd at the scene of the lightning strikes, and witnesses a massive "Tripod" war machine emerge from the ground and use alien weaponry to incinerate most of the witnesses. Ray collects his children, steals a car and drives to Mary Ann's home in suburban New Jersey to take refuge. The next morning, he discovers that a Boeing 747 has crashed in the street. A news team scavenging for food explain that there are multiple Tripods that have attacked major cities including New York City, Washington, D.C., and London, and have force shields to protect them from human weapons. They also explain that the lightning was how the aliens were able to enter the Tripods. Ray decides to take the kids to Boston to be with their mother. The three are forced to abandon the stolen car after a mob takes it by force. They later survive a Tripod attack which causes a Hudson River ferry to sink. During a desperate battle between U.S. Marines and the aliens, Ray is forced to choose between being separated from Rachel and preventing Robbie from joining the fight; he lets Robbie go with the Marines, who are overwhelmed. While escaping, Ray and Rachel are offered shelter by Harlan Ogilvy, who presumes that the aliens had buried their technology on Earth millions of years ago and has delusions that they can fight against the aliens themselves by observing their operations, as they are right next to their camp.
The three remain undetected for two days, even as a probe and a group of the aliens themselves explore the basement. The next morning, Ogilvy suffers a mental breakdown while witnessing a Tripod harvesting human blood and tissue to fertilize an alien vegetation. Concerned that the aliens may hear Ogilvy's madness, Ray is forced to murder him. The basement hideout is exposed when a second probe catches them sleeping. Rachel is soon abducted by a nearby Tripod and Ray allows himself to be abducted, being placed in the same cage with Rachel and other prisoners. As the aliens select him for harvesting, Ray takes a belt of grenades into the machine, having pulled out the pins. The Tripod is destroyed and releases the cage, with Ray and Rachel making it out alive.
Ray and Rachel arrive in a devastated Boston, where the Tripods are collapsing. Ray notices birds landing on a nearby Tripod, indicating that its shields are down. Ray alerts the soldiers escorting his refugee group and they shoot it down. As soldiers advance on the downed Tripod, a hatch opens releasing a liquid and then a sickly alien struggles halfway out, and then succumbs to its disease immediately. Ray and Rachel reach Mary Ann's parents' house, where they are reunited with Mary Ann and, to their surprise, Robbie. The closing narration reveals that the aliens were immune to man's machines but were not immune to the microbes present on Earth and that, "From the moment the invaders arrived, breathed our air, ate and drank, they were doomed."

Question: What does Ray do to Harlan Oglivy to protect himself and Rachel?
Answer: He murders Oglivy in order to keep the aliens from discovering them.
Alternative answer: Murders him