Fentanyl-induced hyperalgesia and antinociception after systemic administration has been shown in previous clinical and experimental studies. However, there is very little evidence regarding the local possible effects of fentanyl. The purpose of this study was to assess whether local (intraplantar) fentanyl administration can produce antinociception and hyperalgesia. In addition, we examined the effects of magnesium, N-methyl-D-aspartate receptor antagonist, on possible changes produced by fentanyl. The paw withdrawal latencies to radiant heat stimuli were measured to assess the thermal nociceptive actions. Intraplantar administration of fentanyl caused time and dose-dependent increase in the paw withdrawal latencies (antinociception). Coinjection of magnesium with fentanyl markedly enhanced the antinociception. However, fentanyl also markedly decreased paw withdrawal latencies 24 h after intraplantar administration (hyperalgesia). In the presence of magnesium, hyperalgesia after fentanyl administration was not observed. Consequently, following the fentanyl administration, local hyperalgesia after antinociception is a negative effect in pain treatment. Magnesium may not only prevent the hyperalgesia but also enhance antinociceptive effect of fentanyl.