Context plays an important role in the formation and expression of habits but is overlooked in the classical view on habit formation. An important obstacle to empirically studying contextual effects has been the scarcity of reliable habit formation protocols. Here, we introduce a habit formation protocol (N=142) and demonstrate devaluation-insensitivity – the gold standard for assessing habit – in extensively overtrained, but not minimally trained (criterion-trained) subjects. Crucially, in a third group we show habit formation for new, minimally trained stimuli following overtraining in the task context (contextual overtraining). We further show that following overtraining, devaluation-insensitive habits predict performance on a two-stage task, a widely used indirect measure of habitual versus goal-directed processing. Finally, we find that a working memory load slows response times in conditions that require the suppression of trained responses. Our findings shed new light on the role of context in habit formation, showing that extensive training in a stable task context not only causes devaluation-insensitivity of the overtrained stimuli, but accelerates new habit formation in that context.