Little is known about the effect of craving on smoking abstinence among cardiac patients who smoked prior to admission and the mechanisms that might facilitate success in smoking cessation after discharge from hospital. This study examined the mediating effect of self-efficacy on the relationship between craving and smoking abstinence and how this mechanism may be contingent on emotional state at the time of hospital admission. Cardiac patients who smoked prior to admission were recruited from cardiac nursing units in Dutch hospitals. On hospitalization, 244 patients completed a questionnaire on craving, self-efficacy to smoking cessation, and anxiety and depression levels. Six months after discharge patients were interviewed to ascertain their smoking status. Simple mediation and moderated mediation effects of craving and self-efficacy on smoking abstinence were tested. Of the patients who successfully completed the baseline questionnaire and the follow-up interview, 38% were not smoking at 6 months. Self-efficacy mediated the effect of craving on smoking abstinence. However, this indirect effect was more pronounced among patients with relatively low to moderate anxiety at the time of hospitalization. Our findings suggest that craving reduces self-efficacy, which in turn reduces the likelihood of smoking abstinence, although this process applies only to those patients with low to moderate anxiety levels at the time of hospitalization. Interventions for smoking cardiac patients should aim to reduce craving and to enhance patients' self-efficacy to smoking cessation after discharge from hospital.