The best way to avoid a real-life version of the movie "Armageddon" would be to push the approaching Near-Earth Object (NEO) enough to speed it up, slow it down or alter its path, any of which could change an extinction-class collision into a merely scary near-collision. NASA scientists offer two options for doing so: an "impulsive" (as in explosion) approach or a slow-push one.
In the impulsive category, a nuclear bomb has the best potential for deflecting a dangerous asteroid or comet.
"Because of the large amount of energy delivered, nuclear devices would require the least amount of detailed information about the threatening object, reducing the need for detailed characterization," stated a March 2007 NASA report ("Near-Earth Object Survey and Deflection Analysis of Alternatives") to Congress. Detonating a nuke on or below the object's surface would pack the most punch -- anywhere from 10 to 100 times more energy than would an above-surface blast. However, NASA added, an above-surface bomb would be less likely to break the NEO into pieces ... something to avoid, because that would mean many smaller but equally dangerous pieces of comet or asteroid still on a collision course with Earth.
Taking aim at a dangerous space object with a nuclear device would require not only fast action but international cooperation, too. Without prior OK from world powers, the approach could violate the Treaty on Principles Governing the Activities of States in the Exploration and Use of Outer Space, including the Moon and Other Celestial Bodies.
An A-bomb isn't the only impulsive option, though. NASA's also explored the possibility of using conventional explosives or some kind of asteroid-aimed "bullet" that could hit an NEO at high speed to alter its path. All those alternatives wouldn't deliver nearly as much firepower as a nuke, though, and would probably have to be much more powerful than needed just in case the approaching object is denser or bigger than scientists thought.
"(K)inetic impacts are ... sensitive to the porosity, elasticity, and composition of the target and may require large performance margins if these characteristics are not well determined," the NASA report stated.