Muscular strain to the cervical spine is the easiest and most likely culprit. I assume you have not received a blow to the back of hte neck, as you'd know why it hurts :}
This said, gentle massage and cold packs may help. Do not strain range of motion.
If this persists more than a few days or a week, consider xrays looking for cervical spine conditions (many of which are minor, so don't worry too much).