The pain-relieving qualities of cannabis have long been hailed, and several countries have made it available for medicinal purposes.
But quantity is key, according to the study in the journal Anesthesiology.
University of California researchers found moderate use had the greatest impact on pain in 15 volunteers, while large doses actually made pain worse.
The team recruited 15 healthy volunteers, in whom pain was induced by injecting capsaicin - the "hot" chemical found in chilli peppers - under their skin.
They were then given cannabis to smoke. The strength of the dose was determined by the tetrahydrocannabinol content, which is the main active chemical in cannabis.
Some of the volunteers were given a placebo.
High, but in pain
Five minutes after smoking the drug, none of the doses had any effect on the pain felt.
But 45 minutes later, those who had smoked the moderate dose said their pain was much better, while those who consumed high doses said it had got worse.
They did, however, feel "higher" than counterparts who had taken moderate doses.
Dr Mark Wallace, the lead researcher, said the findings could have implications for the way medicinal cannabis was offered, both in pure and drug form.
Some experts are concerned that results on healthy volunteers could not be translated into how cannabis works in the bodies of those with cancer or multiple sclerosis, for whom the drug is increasingly seen as a potential form of pain relief.
Dr Laura Bell, of the MS Society, said: "Many people with MS report benefits to symptoms such as pain from taking cannabis, however studies to date on the effects of cannabis on pain are small and difficult to draw firm conclusions from.
"We would be interested to see the results from larger scale studies focused on people with MS."