Neonicotinoid pesticides are a relatively new class of pesticides that have garnered significant attention owing to their potential ecological risks to nontarget organisms. A method combining solid phase extraction with liquid chromatography-tandem mass spectrometry (SPE-LC-MS/MS) was developed for the rapid and accurate detection of eight neonicotinoid pesticides (dinotefuran, E-nitenpyram, thiamethoxam, clothianidin, imidacloprid, imidaclothiz, acetamiprid, and thiacloprid) in wastewater. The chromatographic mobile phase and MS parameters were selected, and a single-factor method was used to determine the optimal column type, extraction volume, sample loading speed, and pH for SPE. The optimal parameters were as follows: column type, HLB column (500 mg/6 mL); sample extraction volume, 500 mL; sample loading speed, 10 mL/min; and sample pH, 6-8. The matrix effects of the wastewater samples were reduced by optimizing the chromatographic gradient-elution program, examining the dilution factor of the samples, and using the isotope internal standard calibration method. Prior to analysis, the wastewater samples were diluted 5-fold with ultrapure water for pretreatment. Subsequently, 2 mmol/L ammonium acetate aqueous solution containing 0.1% (v/v) formic acid and methanol was used as mobile phases for gradient elution on a ZORBAX Eclipse Plus C18 column (100 mm×2.1 mm, 1.8 μm). The samples were quantified using positive-ion multiple reaction monitoring (MRM) mode for 10 min. Imidacloprid-d4 was used as the isotope internal standard. The SPE process was further optimized by applying response surface methodology to select the type and mass of rinsing and elution solvents. The optimal pretreatment of the SPE column included rinsing with 10% methanol aqueous solution and elution with methanol-acetonitrile (1∶1, v/v) mixture (7 mL). The eight neonicotinoid pesticides showed satisfactory linearity within the relevant range, with linear correlation coefficients (r) all greater than 0.9990. The method detection limits (MDLs) ranged from 0.2 to 1.2 ng/L, and the method quantification limits (MQLs) ranged from 0.8 to 4.8 ng/L. The average recoveries of the eight neonicotinoid pesticides were in the range of 82.6%-94.2% at three spiked levels, with relative standard deviations (RSDs) ranging from 3.9% to 9.4%. Finally, the optimized method was successfully applied to analyze wastewater samples collected from four sewage treatment plants. The results indicated that the eight neonicotinoid pesticides could be generally detected at concentrations ranging from not detected (ND) to 256 ng/L. The developed method has a low MDL and high accuracy, rendering it a suitable choice for the trace detection of the eight neonicotinoid pesticides in wastewater when compared with other similar methods. The proposed method can be utilized to monitor the environmental impact and assess the potential risks of neonicotinoid pesticides in wastewater, thus promoting the protection of nontarget organisms and the sustainable use of these pesticides in agriculture.