Pain perception in non-mammalian vertebrates such as fish is a controversial issue. We demonstrate that, in the fish Leporinus macrocephalus, an imposed restraint can modulate the behavioral response to a noxious stimulus, specifically the subcutaneous injection of 3% formaldehyde. In the first experiment, formaldehyde was applied immediately after 3 or 5 min of the restraint. Inhibition of the increase in locomotor activity in response to formaldehyde was observed, which suggests a possible restraint-induced antinociception. In the second experiment, the noxious stimulus was applied 0, 5, 10 and 15 min after the restraint, and both 3 and 5 min of restraint promoted short-term antinociception of approximately 5 min. In experiments 3 and 4, an intraperitoneal injection of naloxone (30 mg.kg−1) was administered 30 min prior to the restraint. The 3- minute restraint-induced antinociception was blocked by pretreatment with naloxone, but the corresponding 5-minute response was not. One possible explanation for this result is that an opioid and a non-preferential μ–opioid and/or non-opioid mechanism participate in this response modulation. Furthermore, we observed that both the 3- and 5- minutes restraint were severely stressful events for the organism, promoting marked increases in serum cortisol levels. These data indicate that the response to a noxious stimulus can be modulated by an environmental stressor in fish, as is the case in mammals. To our knowledge, this study is the first evidence for the existence of an endogenous antinociceptive system that is activated by an acute standardized stress in fish. Additionally, it characterizes the antinociceptive response induced by stress in terms of its time course and the opioid mediation, providing information for understanding the evolution of nociception modulation.