Context: Magnesium and MK-801 (dizocilpine), antagonists of N-methyl-d-aspartate receptors, are involved in the processing of pain.Objective: This study determines whether magnesium sulfate (MS) and MK-801 affects visceral inflammatory pain and determines a possible mechanism of action.Materials and methods: Analgesic activity was assessed using the acetic acid-induced writhing test in rats. MS (1–45 mg/kg) or MK-801 (0.005–0.03 mg/kg) was administrated subcutaneously (s.c.). To assess possible mechanisms of action, we examined the effects of l-NAME (10 mg/kg, intraperitoneal), methylene blue (0.5 mg/kg, s.c.), and glibenclamide (3 mg/kg, s.c.) on the effect of MS or MK-801.Results: MS and MK-801 showed biphasic and linear dose–response pattern, respectively. MS reduces the number of writhing on the dose of 1, 5, and 15 mg/kg by 60, 50, and 78%, respectively, while it has no effects on the doses of 30 and 45 mg/kg. MK-801 (0.005–0.03 mg/kg) showed decrease in the number of writhing by 33–79%. The mean effective doses of MS and MK-801 were 6.6 (first phase) and 0.009 mg/kg, respectively. Both drugs did not impair the rotarod performance. l-NAME, methylene blue, and glybenclamide reduced the effect of MK-801 by 100, 43, and 64%, respectively, but not the effect of MS.Conclusions: The results suggest that MS and MK-801 may be useful analgesics in the management of visceral inflammatory pain, at doses that do not induce motor impairment. The modulation of NO/cGMP/K+ATP pathway plays an important role in the antinociceptive mechanism of MK-801, but does not contribute to the antinociceptive effect of MS.