We analyse spatial dependence between the risks of stock markets. An alternative definition of neighbour is used and is based on a proposed exogenous criterion obtained with a dynamic Google Trends Uncertainty Index (GTUI) designed specifically for this analysis. We show the impact of systemic risk on spatial dependence related to the most significant financial crises from 2005: the Lehman Brothers bankruptcy, the sub-prime mortgage crisis, the European debt crisis, Brexit and the COVID-19 pandemic, which also affected the financial markets. The risks are measured using the monthly variance or volatility and the monthly Value-at-Risk (VaR) of the filtered losses associated with the analysed indices. Given that the analysed risk measures follow non-normal distributions and the number of neighbours changes over time, we carry out a simulation study to check how these characteristics affect the results of global and local inference using Moran’s I statistic. Lastly, we analyse the global spatial dependence between the risks of 46 stock markets and we study the local spatial dependence for 10 benchmark stock markets worldwide.