Scratching an itch provides temporary relief by creating mild pain that overrides the itch signals. This action also triggers the release of serotonin, a neurotransmitter associated with feelings of well-being, which adds to the pleasurable sensation.