Fentanyl injection is used to relieve severe pain during and after surgery. It is also used with other medicines just before or during an operation to help the anesthetic (numbing medicine) work better. Fentanyl belongs to the group of medicines called opioid analgesics (pain medicines).