The primary goals of this study were to use ecological momentary assessment (EMA) to examine the extent to which proximal factors (cravings and affect) were temporally associated with relapse, and to assess the role of distal factors (e.g., coping styles) in moderating these associations. We also examined whether using EMA procedures impacted relapse rates. A sample of 100 male (n = 66) and female (n = 34) patients entering outpatient treatment for substance abuse completed a baseline assessment of substance dependence, stress, social support, coping styles, family history of substance abuse, and self-efficacy. Half of the participants were randomly assigned to receive training in using a handheld computer to respond to 3 random prompts each day for 4 months regarding cravings, affect, and substance use. All participants completed 2- and 4-month follow-up assessments of substance use. Results showed that using EMA procedures did not influence relapse rates. Hierarchical linear modeling showed that individuals who reported an increase in cravings on a given prompt were 14 times more likely to report relapse on the subsequent prompt than individuals who did not experience an increase in cravings. In addition, women, older individuals, and individuals who use distraction and disengagement as coping styles were at increased risk for relapse when experiencing an increase in cravings. Individuals who use acceptance as a coping style were at decreased risk for relapse when experiencing an increase in cravings. The study highlights the importance of tailoring treatments to address the needs of particular individuals and risk factors.