Purpose With the opening up of the economy since the 1959 Economic Stabilization Plan, was it the production of electricity that drove the growth of gross domestic product (GDP) in Spain or, on the contrary, was it the growth of GDP that drove the production of electricity well into the 21st century? The purpose of this paper is to answer this question. Design/methodology/approach A cointegration approach based on the studies conducted by Pesaran and Shin (1999) and Pesaran et al. (2001) is applied, as it is suitable for short data series like those used in this paper. Findings The results of this paper allow us to conclude that electricity production boosted economic growth in Spain during the period under study, confirming the growth hypothesis. Research limitations/implications The results of this paper should be interpreted with caution, as electricity today amounts to less than a quarter of the total amount of energy used in Spain. It was not possible to incorporate other inputs to the production function (such as other energy inputs, technological or human capital), but the methodology used avoids the problems of omitted variables and of autocorrelation. Practical implications The results show that a small economy with limited resources, such as the Spanish one, is more vulnerable to energy shocks than other energy-sufficient economies. As Spain is a country with high energy dependence from abroad, the government must first ensure the electricity supply. Increased availability and access to different sources of electricity will improve the outlook for the Spanish economy. Conversely, a shortage in supply of electricity will constrain the regular pace of economic growth. Social implications Spain should investigate and explore more efficient and cost-effective sources of energy, in particular the renewable energies, as traditional energy sources will be scarce before long. Originality/value This paper differs from previous ones carried out for Spain in several aspects: it considers a broader period of time, from 1958 to 2015; the relationships between electricity production and GDP are analysed for the first time in a neo-classical production function where electricity, capital and employment are considered as separate factors; and a cointegration approach based on the studies conducted by Pesaran and Shin (1999) and Pesaran et al. (2001) is applied, as it is suitable for short data series like those used in this paper.