The cyanobacterium Nostoc flagelliforme is an extremophile that thrives under extraordinary desiccation and ultraviolet (UV) radiation conditions. To investigate its survival strategies, we performed whole-genome sequencing of N. flagelliforme CCNUN1 and transcriptional profiling of its field populations upon rehydration in BG11 medium. The genome of N. flagelliforme is 10.23 Mb in size and contains 10 825 predicted protein-encoding genes, making it one of the largest complete genomes of cyanobacteria reported to date. Comparative genomics analysis among 20 cyanobacterial strains revealed that genes related to DNA replication, recombination and repair had disproportionately high contributions to the genome expansion. The ability of N. flagelliforme to thrive under extreme abiotic stresses is supported by the acquisition of genes involved in the protection of photosynthetic apparatus, the formation of monounsaturated fatty acids, responses to UV radiation, and a peculiar role of ornithine metabolism. Transcriptome analysis revealed a distinct acclimation strategy to rehydration, including the strong constitutive expression of genes encoding photosystem I assembly factors and the involvement of post-transcriptional control mechanisms of photosynthetic resuscitation. Our results provide insights into the adaptive mechanisms of subaerial cyanobacteria in their harsh habitats and have important implications to understand the evolutionary transition of cyanobacteria from aquatic environments to terrestrial ecosystems.