Purpose: To quantify how postural stability is modified during experimental pain while performing different cognitively demanding tasks. Methods: Sixteen healthy young adults participated in the experiment. Pain was induced by intramuscular injection of hypertonic saline solution (1 mL, 6%) in both vastus medialis and vastus lateralis muscles (0.9% isotonic saline was used as control). The participants stood barefoot in tandem position for 1 min on a force plate. Center of pressure (CoP) was recorded before and immediately after injections, while performing two cognitive tasks: (i) counting forwards by adding one; (ii) counting backwards by subtracting three. CoP variables—total area of displacement, velocity in anterior–posterior (AP-velocity) and medial–lateral (ML-velocity) directions, and CoP sample entropy in anterior–posterior and medial–lateral directions were displayed as the difference between the values obtained after and before each injection and compared between tasks and injections. Results: CoP total area (− 84.5 ± 145.5 vs. 28.9 ± 78.5 cm 2) and ML-velocity (− 1.71 ± 2.61 vs. 0.98 ± 1.93 cm/s) decreased after the painful injection vs. Control injection while counting forward (P < 0.05). CoP total area (12.8 ± 53.9 vs. − 84.5 ± 145.5 cm 2), ML-velocity (− 0.34 ± 1.92 vs. − 1.71 ± 2.61 cm/s) and AP-velocity (1.07 ± 2.35 vs. − 0.39 ± 1.82 cm/s) increased while counting backwards vs. forwards after the painful injection (P < 0.05). Conclusion: Pain interfered with postural stability according to the type of cognitive task performed, suggesting that pain may occupy cognitive resources, potentially resulting in poorer balance performance.