widescreen version
The FBI responds to a brief computer outage at their Cyber-Security Division by tracing down top computer hackers, finding several of them have been killed. Taking others into protective custody, the FBI asks New York City Police Department detective John McClane (Bruce Willis) to bring in Matthew "Matt" Farrell (Justin Long), one of the targeted hackers. McClane finally arrives just in time to prevent Farrell from being killed by assassins working for a mysterious cyber-terrorist named Mai Linh (Maggie Q), working for her boss and love interest, Thomas Gabriel (Timothy Olyphant).
En route to Washington, D.C. with McClane, Farrell reveals that he received a large sum of money from Mai to write an algorithm that can crack a security system. As McClane and Farrell arrive in Washington, Gabriel orders his own crew of hackers to take control of the transportation grids and stock market, while nationally broadcasting a message threatening the United States. Farrell recognizes this as the start of a "fire sale", an attack designed to target the nation's reliance on computer controls, such that "everything must go". McClane and Farrell are taken by police escort to the secure FBI headquarters, but Mai reroutes the convoy into the path of an assault helicopter. McClane takes downs the helicopter by launching a police car over a damaged toll booth into it.
As McClane and Farrell finally recover, Gabriel initiates a second broadcast by showing a simulated explosion of the U.S. Capitol building, sending the public into panic. Farrell recognizes that his next target of the "fire sale" is likely the power grid, and the two drive to a utility superstation in West Virginia. When they arrive, a team led by Mai is breaking in and taking over the station's controls. McClane kills all of them, and sends Mai to her death in a vehicle at the bottom of an elevator shaft. He obtains video footage of Gabriel which he relays to the FBI. Enraged over Mai's death, Gabriel takes remote control of the natural gas distribution system and redirects all of the gas into the station. McClane and Farrell manage to escape before the station explodes, leaving much of the eastern seaboard without power.
Farrell connects McClane with a fellow hacker, Frederick "Warlock" Kaludis (Kevin Smith), in Baltimore. Running his computer systems from several generators, Warlock identifies the piece of code Farrell wrote as a means to access data at a master Social Security Administration building at Woodlawn, Maryland. They realize the building is actually a cover-up NSA facility, designed by Gabriel when he worked for the NSA as a backup facility for the nation's entire personal and financial records to be used in the event of a cyber attack similar to the one Gabriel has created. Warlock tells McClane and Matt that Gabriel is an extremely talented programmer who was a top security expert for the U.S. Defense Department. Gabriel tried to alert the politicians and military leadership to critical weaknesses that left America's network infrastructure open to cyberwarfare, but his methods led to his dismissal. Warlock runs a traceroute and attempts to identify Gabriel's location, but Gabriel detects the intrusion.
Gabriel taps into their connection and speaks with Warlock, Farrell, and McClane. Gabriel reveals that he had successfully located McClane's estranged daughter, Lucy (Mary Elizabeth Winstead), and intends to kidnap her. McClane and Farrell race to the Woodlawn facility, where Farrell soon discovers that Gabriel is downloading all the information onto his portable computer system in order to blackmail the U.S government, and he manages to encrypt the data before all of Gabriel's henchmen can access it. However, Gabriel kidnaps Farrell as he tries to escape the facility. McClane pursues Gabriel, hijacking his semi. McClane enlists Warlock to trace Gabriel's vehicle. With McClane in pursuit, Gabriel accesses the communication system of a U.S. Marine Corps F-35B Lightning II.
Pretending that he is an air traffic controller, Gabriel orders the pilot to attack the truck McClane is driving, in which McClane manages to escape the assault when debris from the damaged truck fall into the jet intake of the aircraft from a highway exit ramp. McClane makes his way to a nearby warehouse where Warlock has successfully tracked Gabriel and is installing the remaining files, holding Lucy. Although McClane kills most of Gabriel's remaining henchmen, Emerson (Edoardo Costa) shoots him in the right shoulder, injuring him.
While Gabriel tries to hold McClane from behind, McClane manages to gain control of Gabriel's weapon and fatally shoots him through his own shoulder, killing him, but he survives his injury. Farrell then kills Emerson in the ensuing confusion. As the FBI finally arrives to tend to his wounds and clean up the scene, recovering the stolen files in the process, McClane pretends to be displeased with the romantic feelings developing between Farrell and Lucy as he sits with her in the ambulance van.