The neutron lifetime has been measured by comparing the decay rate with the reaction rate of $^3$He nuclei of a pulsed neutron beam from the spallation neutron source at the Japan Proton Accelerator Research Complex (J-PARC). The decay rate and the reaction rate were determined by simultaneously detecting electrons from the neutron decay and protons from the $^3$He(n,p)$^3$H reaction using a gas chamber of which working gas contains diluted $^3$He. The measured neutron lifetime was $898,pm,10,_{rm stat},^{+15}_{-18},_{rm sys},$s.