The ab initio no-core shell model (NCSM) is extended to include a realistic three-body interaction in calculations for p-shell nuclei. The NCSM formalism is reviewed and new features needed in calculations with three-body forces are discussed in detail. We present results of first applications to 6,7Li, 6He, 7,8,10Be, 10,11,12B, 12N, and 10,11,12,13C using the Argonne V8' nucleon-nucleon (NN) potential and the Tucson-Melbourne TM'(99) three-nucleon interaction (TNI). In addition to increasing the total binding energy, we observe a substantial sensitivity in the low-lying spectra to the presence of the realistic three-body force and an overall improvement in level ordering and level spacing in comparison to experiment. The greatest sensitivity occurs for states where the spin-orbit interaction strength is known to play a role. In particular, with the TNI we obtain the correct ground-state spin for 10,11,12B and 12N, contrary to calculations with NN potentials only.