NASA is already planning the first test of an asteroid defense system.
The mission, called AIDA, will test one of the most basic methods of defense - a kinetic impactor. Which in layman's terms?
They're going to crash a spaceship into one. After, of course, doing a couple of orbits to work out what it's made of. The point is to start determining how much force is needed to adjust the course of a problem asteroid (the sooner the better).
Other ideas for deflecting asteroids include detonating a nuke close to the near side of the asteroid, which should give it a shove away. (Not on the surface like in the movies - the point is to use the heat burst). Or, the really science fiction one - making a really heavy spaceship and parking it on the far side so that its gravitic force gently pulls the asteroid away. The problem with that, of course, is making the spaceship heavy enough...
Either way, we're making progress on avoiding the fate of the dinosaurs.