After a massive meteor shower destroys the Space Shuttle Atlantis, NASA scientists discover they have eighteen days before an asteroid the size of Texas impacts Earth, destroying all planetary life. NASA executive Dan Truman leads a team which devises a plan to have the world's best deep core oil driller train a group of astronauts to drill a hole into the asteroid into which they will insert and detonate a nuclear bomb to split the asteroid in half.
They recruit Harry Stamper, a third-generation oil driller and owner of his own oil drilling company. Harry agrees to help NASA, but on the condition that he bring in his own team to do the drilling. He picks his best employees for the job: Chick Chapel, his best friend and right-hand man, drillers Bear Curlene, Freddie Noonan, Max Lennert, and A.J. Frost, who has been dating Harry's daughter Grace over Harry’s objections, and geologists Rockhound and Oscar Choice. Over 12 days, they train with skeptical professional astronaut Willie Sharp, who will pilot Freedom, one of the two shuttles to fly to the asteroid, the other being the Independence. Before leaving, Chick apologizes to his ex-wife for wronging her and Grace accepts A.J.’s marriage proposal.
Both shuttles take off without incident and dock with the Russian Space Station Mir to take on the necessary fuel for the continued journey to the asteroid. During fueling, a spark ignites fuel from a leaky fuel line, causing a fire. A.J. and Russian Cosmonaut Lev Andropov are nearly killed but manage to get on board Independence before the space station is destroyed.
On approach to their landing site on the asteroid, Independence is irreparably damaged by debris and the shuttle crashes, killing all on board except Lev, Bear, and A.J. They embark in the shuttle’s Armadillo to find Freedom crew, which landed 26 miles from its intended landing site on a plate of iron ferrite. When the drilling goes slower than predicted, Sharp reports to Mission Control that it is unlikely that Harry and his team will reach the depth necessary to split the asteroid before "Zero Barrier", the point after which the two halves of the asteroid would impact Earth. Even though it might cause the whole mission to fail, the President of the United States decides to remote detonate the bomb from Earth. After a vicious argument where Sharp calls Harry’s team the worst mistake in NASA history, the two men agree to defuse the bomb and work together. They make progress on drilling, but when they hit a hydrogen pocket, Max and the Armadillo are lost. Just as Harry, Truman, and the world believe the mission to be a failure, A.J. and the others arrive in the second Armadillo.
A.J. succeeds in drilling the hole to the required depth, but a rock storm damages the remote detonator, forcing someone to have to stay behind to manually detonate the bomb. After randomly drawing straws, the responsibility falls on A.J., but Harry takes him down to the asteroid’s surface, he disconnects A.J.’s air hose and forces him into the shuttle’s air lock, telling A.J. he is the son he never had and that he would be proud to have him marry Grace. Using the Armadillo, Harry gives Grace his blessing to marry A.J. and Grace says she is proud to be his daughter.
After some difficulty, Freedom takes off, but another rock storm causes Harry to lose his grip on the detonator. Just before Zero Barrier, Harry detonates the bomb saving the planet. NASA and the world rejoice while Truman comforts Grace. The astronauts land back on Earth safely: A.J. and Grace are reunited and Chick reconciles with his ex-wife and estranged young son.
Some time later A.J. and Grace are married.
Bruce Willis as Harry S. Stamper
Billy Bob Thornton as Dan Truman
Ben Affleck as A.J. Frost
Liv Tyler as Grace Stamper
Will Patton as Chick
Steve Buscemi as Rockhound
William Fichtner as Colonel Willie Sharp
Owen Wilson as Oscar
Michael Clarke Duncan as Bear
Peter Stormare as Lev Andropov
Ken Campbell as Max
Jessica Steen as Co-Pilot Jennifer Watts
Keith David as General Kimsey
Chris Ellis as Flight Director Clark
Jason Isaacs as Ronald Quincy
Grayson McCouch as Gruber
Clark Brolly as Noonan
Marshall Teague as Colonel Davis
Anthony Guidera as Co-Pilot Tucker
Greg Collins as Halsey
John Mahon as Karl
Grace Zabriskie as Dottie
Eddie Griffin as Bike Messenger
Jim Ishida as Client #3
Stanley Anderson as The President
Charlton Heston as the Narrator