Synthetic opioids are lab‐synthesized substances that target the brain's opioid receptors, offering analgesic and sedative effects. Amongst them, fentanyl is one of the most widely used to intervene in chronic pain in moderate to severe cancer situations. Butyryl fentanyl (BF) is a novel synthetic opioid whose use is growing. Its potency is seven times that of morphine and, unlike fentanyl, BF can only be obtained through illegal sources. Fentanyl and its analogues are related to harmful intoxications and an increase in opioid‐related mortality in many countries, such as in the United States and Europe in recent years. This work developed and validated an effective and sensitive method based on solid‐phase extraction followed by gas chromatography‐mass spectrometry (GC‐MS) for the determination of fentanyl and BF in oral fluid samples. To the best of our knowledge, it is the first successful attempt to quantify these analytes using GC‐MS with a limit of quantification (LOQ) of 1 ng/mL in OF. Intra‐day and inter‐day percentage coefficient of variation were found within 1%–3% and 1%–14%, respectively, while accuracy ranged from 92% to 102% at four concentration levels (lower LOQ [LLOQ], 3, 20, 40 ng/mL) in accordance with the established criteria. The absolute recovery values were in the range of 80.0%–100.0%. The method was linear for all analytes, with quadratic regression of calibration curves always higher than 0.99. The validated method demonstrated its great potential to detect and quantify fentanyl and its analogue in OF and it can be useful not only in forensic investigations of addiction histories but also in epidemiological studies on the spread of fentanyl and BF among workers and/or drivers.