We propose a generalization of the concept of assortativity based on the tensorial representation of multilayer networks, covering the definitions given in terms of Pearson and Spearman coefficients. Our approach can also be applied to weighted networks and provides information about correlations considering pairs of layers. By analyzing the multilayer representation of the airport transportation network, we show that contrasting results are obtained when the layers are analyzed independently or as an interconnected system. Finally, we study the impact of the level of assortativity and heterogeneity between layers on the spreading of diseases. Our results highlight the need of studying degree–degree correlations on multilayer systems, instead of on aggregated networks.