The cannabis-based spray, like a mouth freshener, was used on 177 patients by researchers from Edinburgh University.
They found that it reduced pain levels by 30% in a group of cancer patients, all in the Edinburgh area, who had not been helped by morphine or other medicines.
The spray was developed so that it did not affect the mental state of patients in the way that using cannabis would.
Loading article content
The researchers said their findings, reported in the Journal of Pain and Symptom Management, did not justify smoking cannabis as this could increase the risk of cancer.
They said the spray works by activating molecules in the body called cannabinoid receptors which can stop nerve signals being sent to the brain from the site of pain.
Edinburgh University's Professor Marie Fallon said: "These early results are very promising and demonstrate that cannabis-based medicines may deliver effective treatment for people with severe pain.
"Prescription of these drugs can be very useful in combating debilitating pain, but it is important to understand the difference between their medical and recreational use."