A combination of SiO2@AuNPs@PDA molecularly imprinted and surface-assisted laser desorption/ionization–time-of-flight mass spectrometry (SALDI–TOF MS) was devised as a method for highly specific and ultrasensitive detection of two biogenic amines—histamine (HIS) and tryptamine (TRP)—in real samples. In this strategy, AuNPs modified amino-abundant silica nanospheres (SiO2@AuNPs). The prepared SiO2@AuNPs were used as a substrate to synthesize a molecularly imprinted polymer (MIP) through in situ dopamine self-polymerization with HIS and TRP as the template molecules (SiO2@AuNP@PDA-MIP). The as-prepared MIP structure, properties, and target-analyte identification conditions were characterized and optimized and it was used as the matrix for MS. Compared to the case of nonimprinted materials, the imprinting function endowed the matrix with a higher selectivity for capturing the target molecules. The enriched analytes were directly and rapidly identified using SALDI–TOF MS without elution. Meanwhile, the proposed method has low background interference, good reproducibility and stability, high salt tolerance, and satisfactory linearity (R2 > 0.99), and it enables ultrasensitive detection of HIS and TRP (limits of detection for HIS and TRP were 0.2 and 0.1 ng mL−1, respectively). Moreover, the proposed method was applied to analyze samples of real beer, sausage, and chicken, and the results agreed with those obtained via liquid chromatography–MS, suggesting that the method has excellent practical applications in the field of food safety.