Although the hierarchical structure of human action is widely acknowledged, we do not fully understand how hierarchies of action are assembled. The standard view is that low-level actions are sequenced to establish higher-level routines of behaviour. Here we develop an alternative approach to building hierarchies, based on two insights. First, we consider relations between sequence elements. Second, we identify abstract features common to several such relations, and show how these abstract features allow for flexible action sequence learning. We combine sequencing and abstraction within a single model of hierarchical structure and test this model in two distinct versions of a novel experimental paradigm. We demonstrate that humans can learn entirely novel sequences of actions without practice, by generalising learned sequence structures from one context to another. Computational modelling showed that this ‘zero-shot learning’ of novel behaviours was successfully captured by a hierarchical organisation of the kind we propose.