Newton's third law states that if an object A exerts a force on object B, then object B must exert a force of equal magnitude and opposite direction back on object A.
Let:
A = Hammer
B = Nail
so:

Therefore:
The hammer exerts a force on the nail; the nail exerts a force on the hammer.