Retrieving high-content gene-expression information while retaining 3D positional anatomy at cellular resolution has been difficult, limiting integrative understanding of structure and function in complex biological tissues. Here we develop and apply a technology for 3D intact-tissue RNA sequencing, termed STARmap (Spatially-resolved Transcript Amplicon Readout Mapping), which integrates hydrogel-tissue chemistry, targeted signal amplification, and in situ sequencing. The capabilities of STARmap were tested by mapping 160 to 1,020 genes simultaneously in sections of mouse brain at single-cell resolution with high efficiency, accuracy and reproducibility. Moving to thick tissue blocks, we observed a molecularly-defined gradient distribution of excitatory-neuron subtypes across cubic millimeter-scale volumes (>30,000 cells), and discovered a short-range 3D self-clustering in many inhibitory-neuron subtypes that could be identified and described with 3D STARmap.