It would depend massively on the size of the asteroid, it's composition and how far out it was detected.
For the true planet killers it is extremely likely that the asteroid would be detected years in advance. Asteroids "planet killer" like Apophis are simply too big (Apophis is over 300m) to be missed. This gives us a significant advantage as it both gives us time to put together a mission and vastly reduces the amount by which the asteroid has to be re-directed. In this circumstances there are three main solutions:
Gravitational tractor - the good
Fly a spacecraft next to the asteroid, stop it stationary to the asteroid (using it's thrusters to maintain distance) and allow the gravitational attraction between the asteroid and the spacecraft to act as a tow rope, towing the asteroid along. This has the advantages of having very little which can go wrong and creating no orbital debris. However, the forces involved are simply too small to redirect a "planet killer" size asteroid in a reasonable timeframe
Nuke thruster - the cool
Fly a spacecraft packed with a (for a this kind of asteroid, really really big) nuke next to one side of the asteroid and blow it up. The energy released by the nuke will vaporise one side of the asteroid creating thrust. If a planet killer was discovered today this would probably be our best bet, as (thanks to the cold war) we have the technology to make some extremely powerful nukes as well as the rockets to get them there. This does, however, have some major downsides. While there is no threat of nukes going off in the event of a launch failure (setting off a nuclear bomb is an extremely precise process - the US has accidentally set fire to them and dropped them out of aeroplanes on multiple occasions and they have never gone off) it would scatter a lot of highly radioactive material. Additionally, it is likely that this would create a vast amount of orbital debris.
Smaller asteroids
Our current system - ATLAS https://atlas.fallingstar.com/home.php - gives one day's warning for a 30 kiloton asteroid, a week for a 5 megaton and three weeks for a 100-megaton. For context the Chelyabinsk meteor had a mass of about 12000 tons (note at 11km/s - escape velocity and therefore the lowest velocity at which an asteroid can hit Earth - each ton of matter has about the same energy as 15 tons of TNT). Depending on the accuracy with which the asteroid's trajectory can be calculated this warning it may allow the impact area to be evacuated (though considering that even a 5 megaton asteroid "only" has a TNT equivalent of about 3 Tsar Bomba's there are still a lot of places on earth where this could hit and do almost no damage). Therefore while this class certainly isn't good news their yields are low enough and the warning time long enough that they don't pose an existential threat.
However, the 100kt+ range is the real worry, with our current detection capabilities we'd need something ready to go - which we don't have. And their yield (equivalent to hundreds of Tsar Bomba's) is sufficient to obliterate the area for hundreds of kilometres and cause something similar to a nuclear winter.
ICBM's
Before someone inevitably suggest ICBM's, no they wouldn't work - while they look good on paper. They lack the delta V to intercept an asteroid at sufficient distance to redirect it, and they also lack the yield to vaporise all but the smallest asteroids (it is also doubtful they they would have the yield for either). To destroy a large asteroid after a late detection would require an extremely large rocket carrying an extremely large nuke and guided very precisely to it's target.