Dengue transmission poses significant challenges for public health authorities worldwide due to its susceptibility to various factors, including environmental and climate variability, affecting its incidence and geographic spread. This study focuses on Costa Rica, a country characterized by diverse microclimates nearby, where dengue has been endemic since its introduction in 1993. Using wavelet coherence and clustering analysis, we performed a time-series analysis to uncover the intricate connections between climate, local environmental factors, and dengue occurrences. The findings indicate that multiannual dengue frequency (3 yr) is correlated with the Oceanic Niño Index and the Tropical North Atlantic Index. This association is particularly prominent in cantons located along the North and South Pacific Coast, as well as in the Central cantons of the country. Furthermore, the time series of these climate indices exhibit a leading phase of approximately nine months ahead of dengue cases. Additionally, the clustering analysis uncovers non-contiguous groups of cantons that exhibit similar correlation patterns, irrespective of their proximity or adjacency. This highlights the significance of climate factors in influencing dengue dynamics across diverse regions, regardless of spatial closeness or distance between them. On the other hand, the annual dengue frequency was correlated with local environmental indices. A persistent correlation between dengue cases and local environmental variables is observed over time in the North Pacific and the Central Region of the country's Northwest, with environmental factors leading by less than three months. These findings contribute to understanding dengue transmission's spatial and temporal dynamics in Costa Rica, highlighting the importance of climate and local environmental factors in dengue surveillance and control efforts.