This article analyses the changes in education legislation and the history curriculum in Spain over recent decades. To this end, the characteristics established for the teaching of history in the last two education laws, passed in 2013 and 2020 – the first by a conservative government and the second by a progressive one – are studied and compared. This study is carried out by situating the education debates presented in this research in the social and political context of Spain. The study of these legislative changes allows us to observe the different visions of national identity existing in Spain, which find a prominent area of confrontation in education and the teaching of history. The article also argues that the emergence of the ultra-right has led to a markedly nationalist vision of Spanish history that seeks to recover elements of national unity, and that has become one of the axes defended by conservative options for the teaching of history in Spanish schools. This view contrasts with the approaches advocated in the latest education legislation, which propose a more heterogeneous approach to the subject of identity in Spain.