A sensitive ultra-performance liquid chromatography-electrospray tandem mass spectrometry method, combined with solid-phase extraction and silica cartridge cleanup, was established for nine androgens (androstenedione, 19-nor-4-androstene-3,17-diol, androsterone, epiandrosterone, testosterone, methyltestosterone, trenbolone, nandrolone, stanozolol) and nine progestogens (progesterone, 17alpha-hydroxyprogesterone, 21alpha-hydroxyprogesterone, 6alpha-methyl-hydroxyprogesterone, 17alpha,20beta-dihydroxy-4-pregnene-3-one, megestrol acetate, norethindrone, norgestrel, medroxyprogesterone acetate) in environmental waters. For the various water matrices considered, the overall method recoveries were from 78 to 100%, and no apparent signal suppression was found. The method detection limits for the eighteen analytes in the influent, effluent and surface water samples were 0.20-50, 0.04-20 and 0.01-12 ng/L, respectively. This method was used to analyze the residual androgens and progestogens in the wastewater and surface water samples from Japan, and ten analytes (0.03 (medroxyprogesterone acetate)-1441 ng/L (androsterone)) were detected in the wastewater samples, and four analytes (0.06 (progesterone)-0.46 ng/L (androstenedione)) were detected in the surface water samples.