To evaluate the effectiveness of a rectal nonsteroidal anti-inflammatory drug (indomethacin) for pain relief during a hysterosalpingography (HSG). This prospective, randomized study included 82 women divided randomly into two groups. The study group received self-administered rectal indomethacin, while the control group received a placebo before the procedure. Degrees of pain were evaluated using the visual analog scale (VAS) at four different steps during the procedure and 30 min afterwards. The anxiety-depression status of the patients was evaluated using a validated Turkish version of the Beck anxiety-depression form before the procedure. There were no statistically significant differences in the demographic characteristics of patients. The mean pain scores during tenaculum application (step 2), cervical traction (step 3), contrast injection (step 4) and 30 min after the procedure, were significantly lower in the study than the control group (P < 0.05). Step 4 was the most painful in both groups (VAS scores 3.2 ± 0.6 study vs. 5.3 ± 1.1 control). The mean pain score in step 4 for patients with abnormal HSG results was significantly higher than in patients with normal HSG results (P < 0.05). The mean anxiety and depression scores immediately before the procedure were not statistically different between the groups (P = 0.610 and P = 0.129, respectively). Our study demonstrated a significant reduction in pain in patients who received a single rectal dose of indomethacin; therefore, we recommend the use of rectal indomethacin for reducing pain during a HSG procedure.