The abuse of opioid drugs, both illicit and prescription, is a persistent problem in the United States, accounting for >1.2 million users who require treatment each year. Current treatments rely on suppressing immediate withdrawal symptoms and replacing illicit drug use with long-acting opiate drugs. However, the mechanisms that lead to preventing opiate dependence are still poorly understood. We hypothesized that κ opioid receptor (KOR) activation during chronic opioid intake contributes to negative affective states associated with withdrawal and the motivation to take increasing amounts of heroin. Using a 12 h long-access model of heroin self-administration, rats showed escalation of heroin intake over several weeks. This was prevented by a single high dose (30 mg/kg) of the long-acting KOR antagonist norbinaltorphimine (nor-BNI), paralleled by reduced motivation to respond for heroin on a progressive-ratio schedule of reinforcement, a measure of compulsive-like responding. Systemic nor-BNI also significantly decreased heroin withdrawal-associated anxiety-like behavior. Immunohistochemical analysis showed prodynorphin content increased in the nucleus accumbens core in all heroin-exposed rats, but selectively increased in the nucleus accumbens shell in long-access rats. Local infusion of nor-BNI (4 μg/side) into accumbens core altered the initial intake of heroin but not the rate of escalation, while local injection into accumbens shell selectively suppressed increases in heroin intake over time without altering initial intake. These data suggest that dynorphin activity in the nucleus accumbens mediates the increasing motivation for heroin taking and compulsive-like responding for heroin, suggesting that KOR antagonists may be promising targets for the treatment of opioid addiction.