A search for a new scalar resonance decaying to a pair of Z bosons is performed in the mass range from 130 GeV to 3 TeV, and for various width scenarios. The analysis is based on proton-proton collisions recorded by the CMS experiment at the LHC in 2016, corresponding to an integrated luminosity of 35.9 fb−1 at a center-of-mass energy of 13 TeV. The Z boson pair decays are reconstructed using the 4ℓ, 2ℓ2q, and 2ℓ2ν final states, where ℓ = e or μ. Both gluon fusion and electroweak production of the scalar resonance are considered, with a free parameter describing their relative cross sections. A dedicated categorization of events, based on the kinematic properties of associated jets, and matrix element techniques are employed for an optimal signal and background separation. A description of the interference between signal and background amplitudes for a resonance of an arbitrary width is included. No significant excess of events with respect to the standard model expectation is observed and limits are set on the product of the cross section for a new scalar boson and the branching fraction for its decay to ZZ for a large range of masses and widths.[Figure not available: see fulltext.].