A patient's belief that a drug will not work can become a self fulfilling prophecy, according to researchers.
They showed the benefits of painkillers could be boosted or completely wiped out by manipulating expectations.
The study, published in Science Translational Medicine, also identifies the regions of the brain which are affected.
Experts said this could have important consequences for patient care and for testing new drugs.
Heat was applied to the legs of 22 patients, who were asked to report the level of pain on a scale of one to 100. They were also attached to an intravenous drip so drugs could be administered secretly.
The initial average pain rating was 66. Patients were then given a potent painkiller, remifentanil, without their knowledge and the pain score went down to 55.
They were then told they were being given a painkiller and the score went down to 39.
Then, without changing the dose, the patients were then told the painkiller had been withdrawn and to expect pain, and the score went up to 64.
So even though the patients were being given remifentanil, they were reporting the same level of pain as when they were getting no drugs at all.
Professor Irene Tracey, from Oxford University, told the BBC: "It's phenomenal, it's really cool. It's one of the best analgesics we have and the brain's influence can either vastly increase its effect, or completely remove it."
The study was conducted on healthy people who were subjected to pain for a short period of time. She said people with chronic conditions who had unsuccessfully tried many drugs for many years would have built up a much greater negative experience, which could impact on their future healthcare.
Professor Tracey said: "Doctors need more time for consultation and to investigate the cognitive side of illness, the focus is on physiology not the mind, which can be a real roadblock to treatment."
Brain scans during the experiment also showed which regions of the brain were affected.
The expectation of positive treatment was associated with activity in the cingulo-frontal and subcortical brain areas while the negative expectation led to increased activity in the hippocampus and the medial frontal cortex.
Researchers also say the study raises concerns about clinical trials used to determine the effectiveness of drugs.
George Lewith, professor of health research at the University of Southampton, said: "It's another piece of evidence that we get what we expect in life.
"It completely blows cold randomised clinical trials, which don't take into account expectation."