Colloidal crystals are three-dimensional periodic structures formed from small particles suspended in solution. They have important technological uses as optical filters, switches and materials with photonic band gaps, and they also provide convenient model systems for fundamental studies of crystallization and melting. Unfortunately, applications of colloidal crystals are greatly restricted by practical difficulties encountered in synthesizing large single crystals with adjustable crystal orientation. Here we show that the slow sedimentation of colloidal particles onto a patterned substrate (or template) can direct the crystallization of bulk colloidal crystals, and so permit tailoring of the lattice structure, orientation and size of the resulting crystals: we refer to this process as 'colloidal epitaxy'. We also show that, by using silica spheres synthesized with a fluorescent core, the defect structures in the colloidal crystals that result from an intentional lattice mismatch of the template can be studied by confocal microscopy. We suggest that colloidal epitaxy will open new ways to design and fabricate materials based on colloidal crystals and also allow quantitative studies of heterogeneous crystallization in real space.