A method using purge-and-membrane mass spectrometry (PAM-MS) was developed for the analysis of residual solvents in pharmaceutical products. The method combines dynamic headspace and membrane inlet mass spectrometry. The limits of detection for the compounds studied, benzene, toluene, chloroform, 2-pentene and 2-methyl- and 3-methylpentane, were 0.05-0.1 mg/kg. In quantitative analysis the method showed good linearity (r(2) > 0.998) and acceptable within-day (RSD = 7.9-18%) and between-day (RSD = 6.8-10%) repeatability. The PAM-MS method combined with the custom-made Solver program was compared with a method using purge-and-trap gas chromatography/mass spectrometry (P&T-GC/MS) for identification of residual solvents from authentic samples. The results showed that PAM-MS/Solver provides reliable identification of the main volatile organic compounds (VOCs) in the pharmaceuticals, but VOCs with low concentrations (below 0.5 mg/kg) were better identified by P&T-GC/MS. Other advantages of the PAM-MS method were short analysis times and non-requirement for pre-treatment of samples.