This study aimed to prepare a novel quartz crystal microbalance (QCM) sensor for the detection of pirimicarb. Pirimicarb-imprinted poly (ethylene glycol dimethacrylate-Nmetacryloyl-(L)-tryptophan methyl ester) [p (EGDMA-MATrp)] nanofilm (MIP) on the gold surface of a QCM chip was synthesized using the molecular imprinting technique. A nonimprinted p (EGDMA-MATrp) nanofilm (NIP) was also synthesized using the same experimental technique. The MIP and NIP nanofilms were characterized via Fourier transform infrared spectroscopy attenuated total reflectance spectroscopy, contact angle, atomic force microscopy, and an ellipsometer. A competitive adsorption experiment on the sensor was performed to display the selectivity of the nanofilm. An analysis of the QCM sensor showed that the MIP nanofilm exhibited high sensitivity and selectivity for pirimicarb determination. A liquid chromatographytandem mass spectrometry method was prepared and validated to determine the accuracy and precision of the QCM sensor. The accuracy and precision of both methods were determined by a comparison of six replicates at three different concentrations to tomato samples extracted by using a Quick, Easy, Cheap, Effective, Rugged and Safe (QuEChERS) method. The limit of detection of the QCM sensor was found to be 0.028 nM. In conclusion, the QCM sensor showed good accuracy, with recovery percentages between 91 and 94%. Also, the pirimicarb-imprinted QCM sensor exhibited a fast response time, reusability, high selectivity and sensitivity, and a low limit of detection. Therefore, it offers a serious alternative to the traditional analytical methods for pesticide detection in both natural sources and aqueous solutions.