Appliance of science: Why does it feel good to scratch an itch?

Lots of things can cause us to itch but there is one unanimous response to the sensation — scratching. There is nothing quite so satisfying as scratching an itch, but what causes the itch in the first place, and why does scratching bring such relief?