The film begins with the novel's narration (provided by Morgan Freeman), which reflects on how mankind was so busy with their own concerns, but did not know they were being watched by aliens with superior intellects and sinister intentions.
On a cold winter day, Ray Ferrier (Tom Cruise) a dock worker residing in Bayonne, New Jersey, is visited by his ex-wife, Mary Ann (Miranda Otto), who drops off their children, Rachel (Dakota Fanning) and Robbie (Justin Chatwin), at his house as she is going to Boston to meet with her parents. Meanwhile a series of unexplainable lightning storms hits Ukraine, later hitting other parts of the world. While Ray sleeps, Robbie takes Ray's car out of the house without his permission. When Ray wakes up, he goes out to search for his son, and notices a strange wall cloud, which starts to send out electromagnetic pulses in the form of lightning in the nearby area, which disables all working electronic devices in the area, including cars, forcing Robbie to come back to Ray's home. Ray then leaves to investigate, along the way telling Manny, the local mechanic, to replace the solenoid on a dead car. Learning of where the lighting struck the ground by Robbie, Ray and other numerous people are attracted to a small hole in the ground caused by the lightning strikes. The ground then starts to rip open and a massive machine standing on three long legs appears. After emerging, the Tripod makes a loud blaring sound, then opens fire with destructive heat-rays, vaporizing bystanders and destroying everything in its path. Ray manages to escape and return to his house. Knowing it is no longer safe, Ray packs up his kids and leaves. He then manages to steal the vehicle Manny repaired, and along with Robbie and Rachel leave as the tripod destroys the town around them.
Ray drives to Mary Ann's and her new husband's house to take refuge in the basement that night. The next morning he discovers that the tripods have caused a Boeing 747 to crash into the houses. Upon walking upstairs, he sees a jet engine, still spinning, right in the house. Ray meets a small news team searching the wreckage, who show him footage of Tripods destroying other cities, and also that aliens apparently "rode" down the lightning into the ground where the Tripods were located, showing that they have been preparing this invasion for a long time. After hearing the siren of an approaching Tripod, the news crew leaves, and Ray, along with his children, flee to join with Mary in Boston. While driving along NY 385, they are witnesses to a slew of bodies being carried in a river, a sign of the high casualties. Robbie, obsessed with joining the fight against the hostile aliens, tries to leaves with the U.S. military, but Ray and Rachel stop him. They are then forced to leave their car after a mob attacks them in order to take the vehicle, and survive a Tripod attack while navigating the Hudson River on a ferry, which is later capsized by another alien Machine under water.
The family then encounters the military preparing to mount an attack on the Tripods and slow down their advance on a hill top. Upon seeing Robbie's determination to join the fight, Ray lets him go with the military and goes to stop a couple who were carrying Rachel away. As Ray retrieves Rachel, the tripods overwhelm the military and begin to open fire on the refugees. The tripods are revealed to be protected by some kind of energy shield that makes them completely invulnerable to all forms of attack. While escaping from the tripods, Ray and Rachel are offered shelter and protection by a stranger, Harlan Ogilvy (Tim Robbins), who vows revenge on the aliens after his family was killed upon their arrival. He plans to begin a resistance against the aliens, believing that more and more waves of Tripods are on their way. While hiding in Harlan's basement, they witness the Tripods spreading a strange red weed substance over the ground, and avoid detection by both a metallic snake-like probe and four aliens who arrive to explore the basement, although Ogilvy shows his desire to kill one of the aliens. They use a mirror to fool the probe by hiding behind it. The following morning, Ogilvy suffers a mental breakdown after witnessing a Tripod harvesting blood and tissue from a human to fertilize the weed. Concerned that Ogilvy's yelling and ranting will attract the Tripods, Ray kills Ogilvy to silence him. Ray and Rachel's hideout is exposed however when another probe catches them while they sleep. Ray cripples the probe using an axe, but Rachel is so scared she flees the house, eventually being caught by a Tripod.
While pursuing the Tripod, Ray finds several hand grenades in a destroyed Humvee and detonates one of them to attract the Tripod's attention, intending to be captured to try to rescue Rachel. After Ray is captured and put into a basket with Rachel and several other prisoners, the aliens try to pull Ray inside the Tripod to be used as fertilizer for the red weed, but the other prisoners manage to pull him back out of the Tripod. The grenades left by Ray inside the Tripod's cabin then detonate, causing the Tripod to collapse and freeing all the captives.
Soon afterward, Ray and Rachel arrive in Boston, where they notice the red weeds are starting to dry up and die, and the Tripods appear to be dying also. They witness a Tripod acting strangely, struggling to keep balance and taking little notice of the soldiers and refugees. Ray notices a cluster of birds are circling and landing on the hood of the machine, indicating the Tripod's force fields are no longer functioning. Ray alerts nearby soldiers by yelling "Look at the goddamn birds!" who attack and destroy the Tripod with two FGM-148 Javelins and a Carl Gustav recoilless rifle, leaving it crashing through a factory and onto the ground. Approaching the downed Tripod, a hatch opens, revealing an alien pilot that lets out a final growl and dies. Ray and Rachel reach Mary Ann's parents' house and find her and, to their surprise, Robbie, who has somehow survived the attack on the hilltop. As the camera zooms back to overview the wrecked city and downed Tripods, the narrator reveals the aliens were dying because they were suffering from an infection which they contracted from consuming the germs that inhabited Earth's food, water, and humans for which they had no immunity.