In the Atacama Desert, cyanobacteria grow on various substrates such as soils (edaphic) and quartz or granitoid stones (lithic). Both edaphic and lithic cyanobacterial communities have been described but no comparison between both communities of the same locality has yet been undertaken. In the present study, we compared both cyanobacterial communities along a precipitation gradient ranging from the arid National Park Pan de Azúcar (PA), which resembles a large fog oasis in the Atacama Desert extending to the semiarid Santa Gracia Natural Reserve (SG) further south, as well as along a precipitation gradient within PA. Various microscopic techniques, as well as culturing and partial 16S rRNA sequencing, were applied to identify 21 cyanobacterial species; the diversity was found to decline as precipitation levels decreased. Additionally, under increasing xeric stress, lithic community species composition showed higher divergence from the surrounding edaphic community, resulting in indigenous hypolithic and chasmoendolithic cyanobacterial communities. We conclude that rain and fog water, respectively, cause contrasting trends regarding cyanobacterial species richness in the edaphic and lithic microhabitats.