SUMMARY The nucleus is a highly organized arrangement of RNA, DNA, and protein molecules that are compartmentalized within three-dimensional (3D) structures involved in shared functional and regulatory processes. Although RNA has long been proposed to play a global role in organizing nuclear structure, exploring the role of RNA in shaping nuclear structure has remained a challenge because no existing methods can simultaneously measure RNA-RNA, RNA-DNA, and DNA-DNA contacts within 3D structures. To address this, we developed RNA & DNA SPRITE (RD-SPRITE) to comprehensively map the location of all RNAs relative to DNA and other RNAs. Using this approach, we identify many RNAs that are localized near their transcriptional loci (RNA-DNA) together with other diffusible ncRNAs (RNA-RNA) within higher-order DNA structures (DNA-DNA). These RNA-chromatin compartments span three major classes of nuclear functions: RNA processing (including ribosome biogenesis, mRNA splicing, snRNA biogenesis, and histone mRNA processing), heterochromatin assembly, and gene regulation. More generally, we identify hundreds of ncRNAs that form stable nuclear compartments in spatial proximity to their transcriptional loci. We find that dozens of nuclear compartments require RNA to guide protein regulators into these 3D structures, and focusing on several ncRNAs, we show that these ncRNAs specifically regulate heterochromatin assembly and the expression of genes contained within these compartments. Together, our results demonstrate a unique mechanism by which RNA acts to shape nuclear structure by forming high concentration territories immediately upon transcription, binding to diffusible regulators, and guiding them into spatial compartments to regulate a wide range of essential nuclear functions.