A general algorithm for computing the quadrupole-hyperfine effects in the rovibrational spectra of polyatomic molecules is presented for the case of ammonia (NH3). The method extends the general variational approach TROVE {[}J. Mol. Spectrosc. 245, 126-140 (2007)] by adding the extra term in the Hamiltonian that describes the nuclear quadrupole coupling, with no inherent limitation on the number of quadrupolar nuclei in a molecule. We applied the new approach to compute the nitrogen-nuclear-quadrupole hyperfine structure in the rovibrational spectrum of (NH3)-N-14. These results agree very well with recent experimental spectroscopic data for the pure rotational transitions in the ground vibrational and v(2) states and the rovibrational transitions in the v(1), v(3), 2v(4), and v(1) + v(3) bands. The computed hyperfine-resolved rovibrational spectrum of ammonia will be beneficial for the assignment of experimental rovibrational spectra, further detection of ammonia in interstellar space, and studies of the proton-to-electron mass variation. Published by AIP Publishing.