Spontaneous chiral symmetry breaking in QCD with massless quarks at infinite volume can be seen in a finite box by studying, for instance, the dependence of the chiral condensate from the volume and the quark mass. We perform a feasibility study of this program by computing the quark condensate on the lattice in the quenched approximation of QCD at small quark masses. We carry out simulations in various topological sectors of the theory at several volumes, quark masses and lattice spacings by employing fermions with an exact chiral symmetry, and we focus on observables which are infrared stable and free from mass-dependent ultraviolet divergences. The numerical calculation is carried out with an exact variance-reduction technique, which is designed to be particularly efficient when spontaneous symmetry breaking is at work in generating a few very small low-lying eigenvalues of the Dirac operator. The finite-size scaling behaviour of the condensate in the topological sectors considered agrees, within our statistical accuracy, with the expectations of the chiral effective theory. Close to the chiral limit we observe a detailed agreement with the first Leutwyler-Smilga sum rule. By comparing the mass, the volume and the topology dependence of our results with the predictions of the chiral effective theory, we extract the corresponding low-energy constant.