As an acupuncturist, I have tried to answer many variations of this classic question over the decades. For the clients, it is always beneficial to intellectually understand what happens during the acupuncture sessions, and I feel that it is my duty to be able to explain the mechanism of the pain relief by acupuncture in a streamlined fashion. Since this is a vast topic, I will break it into several sections that explain different pathways of the pain relief by acupuncture.
Axon Reflex is a type of reflex that occurs when there are stimuli on the surface of the skin. When the nerve endings receive the stimuli, in addition to transmitting the (afferent) impulse to the central nervous system, the impulse travels to the neighboring nerve endings. This results in those nerve endings releasing neurotransmitters such as Substance P and CGRP to dilate the blood vessels and increase the permeability in the local affected area. Axon Reflex is also called a flare response because the increased blood flow to the target area presents redness (flare) on the skin.
Axon Reflex becomes useful in treating pain due to poor circulation. For example, poor posture and repetitive movement of the hands and arms (i.e. daily desk work) may lead to chronic tension of the neck and shoulders. The chronic tension of the muscles and surrounding soft tissues will cause constriction of blood vessels. The constriction of the blood vessels and decreased blood flow will decrease the oxygen supply to the cells of the muscles and other soft tissues. As the result, microtears of the muscles and other soft tissues occur, and that elicits inflammatory response.
A part of the inflammatory response that is directly related to pain is a group of inflammatory chemicals such as bradykinin, histamine, and prostaglandins. These chemicals are released in response to inflammation and induce pain. Pain signals are warning signs to ourselves that tell us the exact location of the tissue damage so that we can take the necessary step to deal with the damage.

Pain signals play an important role in our bodies, but they become problematic when the pain becomes chronic. By activating axon reflex through acupuncture, blood flow is improved in the affected area and washes away the pain-inducing inflammatory chemicals. As the result, fewer pain signals are sent to our brain.
I remember some of my teachers would observe the flare and told the students that the needles were doing their job. Also, when the flare was gone, those teachers would tell the students that it was time to conclude the treatment. I am always amazed at how such down-to-earth techniques that the masters teach you have scientific bearings.