******* WARNING : The below contents may contain SPOILERS *******
While fixing a satellite in orbit, the Space Shuttle Atlantis is destroyed by a meteor shower, killing the entire crew. Meteorites then bombard New York City and several other parts of the world, and NASA discovers that an asteroid the size of Texas, traveling at 22,000 miles per hour, will collide with Earth in 18 days, effectively destroying the planet. The scientists at NASA - in cooperation with the Russian, Japanese and French space agencies - plan to detonate a nuclear bomb at a precise point under the asteroid's surface which will split it in two, and cause it to miss the Earth. However, the bombs must be planted at least 800 feet below the surface within eight hours of landing, and no later than four hours before the Earth impact. The mission is not revealed to the public, fearing panic.
NASA locates Harry Stamper (Bruce Willis), regarded as the world's best deep-core oil driller, to train NASA astronauts for the drilling. When invited to NASA, Harry brings his 20-something daughter Grace (Liv Tyler) to keep her away from A.J. (Ben Affleck), a young, rambunctious member of his crew who, he has just discovered, has been sleeping with her. This disappoints and infuriates Harry because he did not want his daughter to marry an oil driller like himself or remain in the blue collar life. Head of NASA Dan Truman (Billy Bob Thornton) informs Harry of the dire situation. After hearing Truman's grim scenario, Harry asks if the only job will be to drill the hole & put the bombs down. Truman assures Harry that the only job will be to drill, and no spacewalks or other astronaut duties will be involved, and Harry decides to recruit his own oil-drilling crew for the job to ensure it is done properly. After Harry's crew (Jayotis "Bear" Kurleenbear, Max Lennert, Rockhound, Oscar Choice, Charles "Chick" Chapple and some others) is collected, they are informed by Harry & NASA of the grim situation they - and the world - are faced with. The men agree to do it, provided NASA acquiesces to their demands - and are put through a 12-day training program. They meet their mission commanders; Col. Willie Sharp, USAF (William Fichtner) and NASA pilot Jennifer Watts (Jessica Steen) will command the X-71 Space Shuttle 'Freedom', while Col. Davis, USAF (Marshall Teague) and NASA pilot Tucker (Anthony Guidera) will command the other shuttle, the 'Independence'. The men are introduced to a massive, tank-like drilling rig called the 'Armadillo', one of which will be carried on each Shuttle, and the men outfit the Armadillos with the proper equipment.
After a meteorite strikes Shanghai, China, destroying the city and causing a tsunami, the incoming asteroid and pending mission are revealed to the world. The Freedom and Independence are launched and dock at a Russian space station (crewed by Lev Andropov) to refuel with liquid oxygen propellant. A.J. encounters a problem stopping the pumps after the ships' tanks are full, and the crews are forced to quickly evacuate back to their shuttles and flee as the station explodes. The crews and Lev Andropov escape. Several hours later, the two shuttles perform a high G-force powered slingshot procedure around the Moon, traveling at 22,500 miles per hour to intercept the asteroid.
Entering the asteroid's wake, the Independence is struck by debris, crippling its main thrusters. Col. Davis orders A.J. and his men to don their own oxygen supply & lock themselves in the cargo bay with the Armadillo. As they do, a huge piece of debris smashes out the Independence's cockpit windows and Col. Davis & pilot Tucker are killed in the decompression. In the Freedom, following, Harry sees a writhing, twisting shape and screams, 'Sharp what the hell is that? Is that the Independence?'; his question is answered with a loud 'BANG' as a body hits the Freedom's front window. Col. Sharp informs Houston of the loss of the Independence and, presumably, its crew. The crippled Independence crash-lands on the asteroid, killing most of its crew, including Oscar Choice and Freddie Noonan. AJ, Lev and Bear survive. The Freedom lands on the surface but misses the target landing zone, arriving on an area of hard iron which will be difficult to drill through. The Freedom team tries to drill but suffers several setbacks and losses due to unexpected conditions.
A.J., Andropov, and Bear board the Armadillo, which somehow survived the crash intact, and A.J. starts following a signal on the vehicle's tracking screen, which he hopes will lead them to the Freedom - and Harry's crew. The men are forced to attempt an Evel Knievel-like jump across a massive gorge on the asteroid, and thanks to some heroics from Andropov, they succeed and carry on towards the signal.
After losing communication with Earth, the mission is put on hold, as the bomb's timer is activated by orders from the United States President to ensure the mission succeeds. However, a surface explosion would not be sufficient to divert the asteroid. Truman manages to buy some time by having a NASA controller kill the uplink for the detonator, but the controller is quickly set upon by USAF security officials and the timer is re-activated. On the Freedom, Chick sees the bomb timer counting down, and Harry summons Col. Sharp. The Colonel informs him of the 'Secondary Protocol' which he is under orders to protect, to allow the device to detonate on the surface. After overpowering Sharp, Harry convinces the Colonel that he will drill to 800 feet, no matter what, and Sharp responds, 'Then let's turn this bomb OFF!', and de-activates the bomb. Sharp then joins Harry's men to help them attempt to finish the job. With just 250 feet left to drill, their drilling machine is blasted off the asteroid by a gas vent killing Max in the process. When the crew radio report to NASA that the mission has failed, worldwide panic ensues as humanity braces for the end of the world. A massive meteoroid then strikes Paris, destroying most of the city.
Not long after Paris is struck, the Freedom crew is trying to figure out what to do next when Harry spots a light on the side of his visor. He turns around to see the lights of a vehicle on the cliff above them. It is the second Armadillo, driven to the site by the survivors of the Independence. Harry puts A.J. in charge of finishing the drilling and they successfully drill to the necessary depth. The team lowers the nuclear bomb into the hole, but are caught in a rockstorm. The storm kills crew member Gruber and damages the remote on the bomb, rendering remote detonation useless. With 18 minutes left, Truman tells the team that someone must stay behind to detonate the bomb. Sharp & Watts must stay to fly the shuttle home, so the remaining men draw straws. A.J. is chosen after drawing straws, and Col. Sharp demonstrates to A.J. how to manually activate the detonator. Harry volunteers to take A.J. down, and when the elevator reaches the bottom Harry disables A.J.'s air supply and takes his place. The Freedom tries to leave but experiences engine failure, and once again Andropov comes to the rescue and gets the shuttle's thrusters & main engines going again. Harry sends a message to his daughter from the Armadillo's video feed, giving his full support for her to marry A.J. Seconds later, the Freedom races away from the asteroid, and Colonel Sharp whispers a final goodbye - and thank-you - to Harry.
Harry detonates the bomb exactly at the deadline, causing the asteroid to split in two and miss the Earth by 400 miles, at the cost of his own life. In the wake of one of the massive pieces is the Freedom, heading for home. On the ground, celebrations take place around the world that the asteroid threat is gone. The remaining men & women of Freedom and Independence return to Earth as heroes. As the Freedom touches down at KSC, it is met with the fire crews and families of the astronauts. A.J. reunites with Grace; Chick is met by his son and former wife; Rockhound is met by Molly Mounds - a stripper he had met the night before leaving on the mission; Col. Sharp meets with Grace and offers his gratitude - and admiration - for her father's bravery & selflessness. As the end credits roll, we see Grace and A.J.'s wedding; the guests include Col. Sharp, Bear, Rockhound & Molly, Lev Andropov, and Chick and his former wife, Denise. In the front row stand the photographs of Harry, Oscar, Max & Noonan - the other lost crew members who are remembered.