We decompose sphere partition functions and indices of three-dimensional N=2 gauge theories into a sum of products involving a universal set of "holomorphic blocks". The blocks count BPS states and are in one-to-one correspondence with the theory's massive vacua. We also propose a new, effective technique for calculating the holomorphic blocks, inspired by a reduction to supersymmetric quantum mechanics. The blocks turn out to possess a wealth of surprising properties, such as a Stokes phenomenon that integrates nicely with actions of three-dimensional mirror symmetry. The blocks also have interesting dual interpretations. For theories arising from the compactification of the six-dimensional (2,0) theory on a three-manifold M, the blocks belong to a basis of wavefunctions in analytically continued Chern-Simons theory on M. For theories engineered on branes in Calabi-Yau geometries, the blocks offer a non-perturbative perspective on open topological string partition functions.