The aim of this paper is to identify potential causal relationships between macroeconomic variables and the stock market in Spain. Numerous articles recognize the influence of macroeconomic variables on the stock market and value this knowledge as essential for good investment management. However, there are very few empirical studies that justify the influence of disaggregated macroeconomic variables on the stock market in Spain and vice versa. This article uses the general index of the Madrid Stock Exchange as a proxy variable of the stock market and numerous macroeconomic variables, analyzing monthly data from January 2001 to December 2020 from various published data sources. A descriptive analysis is carried out and a vector autoregressive model (VAR) is applied. Finally, the causality is analyzed identifying the transmission of effects between them. The results confirm the impact of lagged interest rate, monetary aggregate M1 and unemployment rate on the stock market but also identify new features, such as the influence of the stock market on the interest rate, industrial production index, manufacturing activity index and economic sentiment index. This research is useful for Public Administration to detect possible risks in the economy, and it enables investors to better manage their investments.