The electrospray ionization (ESI) ion trap and quadrupole time-of-flight (QqToF) mass spectra of heroin and seven related alkaloids, i.e., morphine, codeine, O-6-monoacetylmorphine (6-MAM), thebaine, acetylcodeine, papaverine and narcotine, have been extensively investigated in this work. The ESI mass spectrometric fragmentation pathways of protonated 6-MAM, heroin, acetylcodeine, and thebaine were comprehensively elucidated for the first time with the aid of high-resolution mass spectrometry. It was found that cleavage of the piperidine ring was the featured fragmentation route of six of the compounds, although not of papaverine and narcotine. In addition, a simple high-performance liquid chromatography (HPLC)-based separation method gave baseline resolution of all eight components. This study could play an important role in the screening for these alkaloids in different matrices by HPLC coupled to tandem mass spectrometry (MS/MS).