We propose a simple and efficient method for generating metrologically useful quantum entanglement in an ensemble of spin-1 atoms that interacts with a high-finesse optical cavity mode. It requires straightforward preparation of N atoms in the m_{F}=0 sublevel, tailoring of the atom-field interaction to give an effective Tavis-Cummings model for the collective spin-1 ensemble, and a photon counting measurement on the cavity output field. The photon number provides a projective measurement of the collective spin length S, which, for the chosen initial state, is heavily weighted around values S≃sqrt[N], for which the corresponding spin states are strongly entangled and exhibit Heisenberg scaling of the metrological sensitivity with N, as quantified by the quantum Fisher information.