Using brain imaging, researchers found that the psychoactive ingredient in cannabis reduced activity in a part of the brain linked to emotional aspects of pain.
But the effect on the pain experienced varied greatly, they said.
Oxford researchers recruited 12 healthy men to take part in their small study, the BBC News reported.
Participants were given either a 15mg tablet of THC (delta-9-tetrahydrocannabinol) - the ingredient that is responsible for the high - or a placebo.
The volunteers then had a cream rubbed into the skin of one leg to induce pain, which was either a dummy cream or a cream that contained chilli - which caused a burning and painful sensation.
Also Read
Each participant had four MRI scans which revealed how their brain activity changed when their perception of the pain reduced.
"We found that with THC, on average people didn't report any change in the burn, but the pain bothered them less," said lead study author Dr Michael Lee.
MRI brain imaging showed reduced activity in key areas of the brain that explained the pain relief which the study participants experienced.
Lee suggested that the findings could help predict who would benefit from taking cannabis for pain relief - because not everyone does.
"We may in future be able to predict who will respond to cannabis, but we would need to do studies in patients with chronic pain over longer time periods," Lee said.
"Cannabis does not seem to act like a conventional pain medicine. Some people respond really well, others not at all, or even poorly," Lee added.
"Brain imaging shows little reduction in the brain regions that code for the sensation of pain, which is what we tend to see with drugs like opiates," Lee said.
"Instead cannabis appears to mainly affect the emotional reaction to pain in a highly variable way," Lee said.
Mick Serpell, a senior lecturer in pain medicine at Glasgow University, said the study confirmed what was already known.
"It highlights the fact that cannabis may be a means of disengagement for the patient, rather than a pain reliever - but we can see that happen with opioids too," Serpell said.
The study was published in the journal Pain.