We present a purely geometrical method for probing the expansion history of the Universe from the observation of the shape of stacked voids in spectroscopic redshift surveys. Our method is an Alcock-Paczynski (AP) test based on the average sphericity of voids posited on the local isotropy of the Universe. It works by comparing the temporal extent of cosmic voids along the line of sight with their angular, spatial extent. We describe the algorithm that we use to detect and stack voids in redshift shells on the light cone and test it on mock light cones produced from N-body simulations. We establish a robust statistical model for estimating the average stretching of voids in redshift space and quantify the contamination by peculiar velocities. Finally, assuming that the void statistics that we derive from N-body simulations is preserved when considering galaxy surveys, we assess the capability of this approach to constrain dark energy parameters. We report this assessment in terms of the figure of merit (FoM) of the dark energy task force and in particular of the proposed EUCLID mission which is particularly suited for this technique since it is a spectroscopic survey. The FoM due to stacked voids from the EUCLID wide survey may double that of all other dark energy probes derived from EUCLID data alone (combined with Planck priors). In particular, voids seem to outperform Baryon Acoustic Oscillations by an order of magnitude. This result is consistent with simple estimates based on mode-counting. The AP test based on stacked voids may be a significant addition to the portfolio of major dark energy probes and its potentialities must be studied in detail.