Of the 342 planets discovered so far orbiting other stars, 58 transit the stellar disk, meaning that they can be detected by a periodic decrease in the starlight flux. The light from the star passes through the atmosphere of the planet, and in a few cases the basic atmospheric composition of the planet can be estimated. As we get closer to finding analogues of Earth, an important consideration toward the characterization of exoplanetary atmospheres is what the transmission spectrum of our planet looks like. Here we report the optical and near-infrared transmission spectrum of the Earth, obtained during a lunar eclipse. Some biologically relevant atmospheric features that are weak in the reflected spectrum (such as ozone, molecular oxygen, water, carbon dioxide and methane) are much stronger in the transmission spectrum, and indeed stronger than predicted by modelling. We also find the fingerprints of the Earths ionosphere and of the major atmospheric constituent, diatomic nitrogen (N2), which are missing in the reflected spectrum.