But the process needs to be fine-tuned to make it commercially viable, they report in the journal Science.
The new method, if it can be made more efficient, could significantly change the multibillion-dollar pain medication manufacturing business, but raises concerns about aggravating the growing problem of opioid abuse.
This same type of approach potentially also could be used to make other currently plant-based medicines for fighting cancer, infectious diseases and chronic illnesses.
The scientists altered the yeast's genetic make-up in a way that coaxed the cells to convert sugar into two opioids -- hydrocodone and thebaine -- in three to five days.
Hydrocodone, which shuts down pain receptors in the brain, and related chemicals like morphine and oxycodone are part of a group of painkilling drugs called opioids produced from the opium poppy. Making opioids from opium poppies can take more than a year.
"This is important because, with further development, it may provide an alternative supply for these essential medicines and allow greater access for most of the global population that currently has insufficient access to pain medication," says the study's lead author Professor Christina Smolke of Stanford University.
The researchers say they recognise their findings on a quicker process to make opioids could generate concern about worsening the growing abuse of these painkillers.