On July 3, the United States conducts a coordinated counterattack; the movie follows the Black Knights, a squadron of Marine Corps F/A-18 Hornets from El Toro Marine Corps Air Station, as they participate in an assault on the destroyer that has devastated the city of Los Angeles. Their weapons fail to penetrate the craft's force field, and it responds by releasing scores of smaller "attacker" ships which are similarly shielded and armed with high-energy torpedos. One-sided dogfights ensue. Captain Steven Hiller (Will Smith) manages to evade the guns of the attacker ships and lures a single attacker to the Grand Canyon. There, as his jet is about out of fuel and the attacker is about to overtake him, he deploys the landing chute for his jet and it drapes across the alien craft, temporarily disorienting the pilot. Captain Hiller then ejects from his jet. The alien crash lands in the desert and Captain Hiller parachutes to a landing close by. He then angrily marches over to find and confront whatever life form it is he might encounter. The door to the alien fighter craft pops open and a very bizarre looking creature with many tentacles appears. Captain Hiller delivers a right cross and knocks the creature out. Captain Hiller says, Now thats what I call a close encounter.
As Hiller is using his parachute to drag the body of the alien across the desert, he is picked up by Russell Casse (Randy Quaid), who is traveling across the desert with a group of refugees in a convoy of RVs. From there they take the captured alien to Area 51, commanded by Major Mitchell (Adam Baldwin). Area 51 also happens to be where the President and his remaining staff have landed. Area 51 conceals a top secret facility housing a repaired attacker ship and three dead alien bodies. Attempts have been underway since the late 1960s to repair the attacker ship. Upon arrival of the alien Mother Ship, the controls for the attacker have become activated.
When lead scientist Dr. Brackish Okun (Brent Spiner) removes an outer "bio-mechanical" suit from the alien, the living being inside is revealed. The creature kills Dr. Okun and the examining crew, and because it has no vocal cords, it makes use of Dr. Okun's voice box to communicate with President Whitmore, who is outside the glass windows of the operating room. Its first words are "Release me." President Whitmore poses a question to the alien: "Can't we live in peace?" The creature says "No." When the President asks the creature what it wants them to do, it responds, "Die." It then uses its telepathic powers to immobilize the President and fling him to the ground. The military personnel with the President then shoot the alien through the glass, with Major Mitchell stepping through the broken glass and delivering a final head shot.
During the instant that President Whitmore was immobilized, he said he was sharing the thoughts of the alien. He learned that the aliens have done this before. They attack planets, use up the resources, kill the life forms, then move on. President Whitmore now issues very clear orders to "nuke the bastards."
B-2 Spirit bombers are deployed, with the first destroyer targeted one that is hovering over a deserted Houston, TX. That weapon explodes, but proves ineffective at penetrating the craft's force field and destroys the city instead; as a result, the President orders the remaining bombers called back.
President Whitmore and his daughter are reunited with the First Lady, Marilyn Whitmore (Mary McDonnell) at Area 51. Mrs. Whitmore had been on a working trip to Los Angeles and got caught up in the destroyer attack there. Captain Hiller's exotic dancer girlfriend, Jasmine (Penina Mezei), rescues the First Lady when she comes across the wreckage of the helicopter the First Lady had been attempting to escape in. Captain Hiller later locates Jasmin, her son Dillon, and the First Lady camped out in the remains of El Toro MCAS and flew them in a helicopter to Area 51. A doctor tells the President that his wife has uncontrollable internal bleeding. When the President goes in to see her, he says, "The doctors say youre gonna be just fine." She smiles and responds softly, "Liar." She dies not long after that.
On July 4, President Whitmores nerves are understandably frayed, so when Secretary of Defense Nimzicki (James Rebhorn) again barks at him about his decisions and actions, President Whitmore physically pushes him and fires him on the spot.
David Levinson suggests a plan that involves using the newly operable attacker to gain access to the interior of the alien mothership in space in order to introduce a computer virus that will disable the protective shields around the destroyers and attackers. Once the computer virus took effect, nuclear weapons would be used to destroy the mothership. Hiller volunteers to be pilot the attacker, with Levinson accompanying him to upload the virus.
With satellite communications knocked out, the Americans have used Morse code to coordinate an attack with the remaining forces around the world, timed to occur when the invaders' shields are set to fail. With not enough military pilots to man all available aircraft, the battle requires several volunteers, including President Whitmore and Russell, who both have previous combat flight experience.
Hiller and Levinson successfully reach the mothership and implant the virus. President Whitmore leads the American jet fighters against the alien destroyer that is approaching Area 51. Although the aliens now lack shields, the fighters' supply of missiles are quickly exhausted against the colossal craft and its large complement of assault ships. The underside of the alien craft opens up as its directed energy weapon prepares to fire on the base. Russell possesses the last remaining missile, but his firing mechanism jams; he decides to pilot his aircraft into the alien weapon in a kamikaze attack. The explosion causes a chain reaction which annihilates the ship. Human resistance forces around the world use the same weak point to destroy the remainder of the alien ships, while the nuclear device planted by Hiller and Levinson destroys the alien mothership soon after the duo escape. Hiller and Levinson are caught up in the aftereffects of the mothership's explosion, but are able to return to earth unharmed, crash-landing the alien fighter in the desert close to Area 51. The film ends as the main characters watch debris from the mothership enter the atmosphere like shooting stars.