Aims. We develop a method for deriving distances from spectroscopic data and obtaining full 6D phase-space coordinates for the RAVE survey's second data release. Methods. We used stellar models combined with atmospheric properties from RAVE (effective temperature, surface gravity and metallicity) and (J-Ks) photometry from archival sources to derive absolute magnitudes. In combination with apparent magnitudes, sky coordinates, proper motions from a variety of sources and radial velocities from RAVE, we are able to derive the full 6D phase-space coordinates for a large sample of RAVE stars. This method is tested with artificial data, Hipparcos trigonometric parallaxes and observations of the open cluster M 67. Results. When we applied our method to a set of 16 146 stars, we found that 25% (4037) of the stars have relative (statistical) distance errors of <35%, while 50% (8073) and 75% (12 110) have relative (statistical) errors smaller than 45% and 50%, respectively. Our various tests show that we can reliably estimate distances for main-sequence stars, but there is an indication of potential systematic problems with giant stars owing to uncertainties in the underlying stellar models. For the main-sequence star sample (defined as those with log(g) > 4), 25% (1744) have relative distance errors <31%, while 50% (3488) and 75% (5231) have relative errors smaller than 36% and 42%, respectively. Our full dataset shows the expected decrease in the metallicity of stars as a function of distance from the Galactic plane. The known kinematic substructures in the U and V velocity components of nearby dwarf stars are apparent in our dataset, confirming the accuracy of our data and the reliability of our technique. We provide independent measurements of the orientation of the UV velocity ellipsoid and of the solar motion, and they are in very good agreement with previous work. Conclusions. The distance catalogue for the RAVE second data release is available at http://www.astro.rug.nl/~rave, and will be updated in the future to include new data releases.