We prove that the profinite completion of the fundamental group of a compact 3-manifold M satisfies a Tits alternative: if a closed subgroup H does not contain a free pro-p subgroup for any p, then H is virtually soluble, and furthermore of a very particular form. In particular, the profinite completion of the fundamental group of a closed, hyperbolic 3-manifold does not contain a subgroup isomorphic to Zb2. This gives a profinite characterization of hyperbolicity among irreducible 3-manifolds. We also characterize Seifert fibred 3-manifolds as precisely those for which the profinite completion of the fundamental group has a non-trivial procyclic normal subgroup. Our techniques also apply to hyperbolic, virtually special groups, in the sense of Haglund and Wise. Finally, we prove that every finitely generated pro-p subgroup of the profinite completion of a torsion-free, hyperbolic, virtually special group is free pro-p.Wilton is supported by the EPSRC and Zalesskii by CNPq and CAPES