Background It has been reported that poststroke pain has a complex pharmacologic background and that only about one-half of poststroke pain patients are sensitive to motor cortex stimulation induced by repetitive transcranial magnetic stimulation (rTMS). Objectives The relationship between pharmacologic background and effects of rTMS of the primary motor cortex was investigated to clarify the pharmacologic basis of rTMS-induced analgesia in poststroke pain patients. Methods Changes in visual analog scale (VAS) score for pain following drug challenge tests using ketamine, morphine, and thiopental were compared with the changes in VAS score following rTMS of the primary motor cortex (frequency 5Hz, at 100% resting motor threshold, 500 pulses per session) in 20 poststroke pain patients. Results In our drug challenge test, 10 of 20 (50%) patients in ketamine test, 7 of 20 (35%) in thiopental test, and 3 of 20 (15%) in morphine test showed more than 40% reduction of VAS score. VAS score decreased immediately after rTMS of motor cortex and persisted for 300min (p < 0.05, Bonferroni's multiple comparisons). Comparison of the magnitude of VAS score reduction between drug challenge test and rTMS showed significant correlations with ketamine test (r = 0.503, p = 0.012), morphine test (r = 0.526, p = 0.009), and thiopental test (r = 0.609, p = 0.002) by regression analysis. Conclusions rTMS-induced VAS score reduction correlated well with morphine, ketamine, and thiopental tests. However, ketamine sensitivity was observed in more cases compared with morphine and thiopental in poststroke pain patients. We speculate that additional pharmacologic therapy using ketamine as determined on the basis of the ketamine test may be useful for enhancing the efficacy of rTMS in poststroke pain patients.