It is generally accepted that vertebrate animals experience pain; however, there is currently inconclusive evidence that the affective component of pain occurs in any invertebrate. Here, we show that octopuses, the most neurologically complex invertebrates, exhibit cognitive and spontaneous behaviors indicative of affective pain experience. In conditioned place preference assays, octopuses avoided contexts in which pain was experienced, preferred a location in which they experienced relief from pain, and showed no conditioned preference in the absence of pain. Injection site grooming occurred in all animals receiving acetic acid injections, but this was abolished by local anesthesia. Thus, octopuses are likely to experience the affective component of pain.