A measurement of the time-dependent ratio of the D0→K+π− to D0→K+π− decay rates is reported. The analysis uses a sample of proton-proton collisions corresponding to an integrated luminosity of 6 fb−1 recorded by the LHCb experiment from 2015 through 2018 at a center-of-mass energy of 13 TeV. The D0 meson is required to originate from a D∗+→D0π+ decay, such that its flavor at production is inferred from the charge of the accompanying pion. The measurement is performed simultaneously for the K+π− and K−π+ final states, allowing both mixing and CP-violation parameters to be determined. The value of the ratio of the decay rates at production is determined to be RKπ=(343.1±2.0)×10−5. The mixing parameters are measured to be cKπ=(51.4±3.5)×10−4 and cKπ′=(13±4)×10−6, where RKπcKπ is the linear coefficient of the expansion of the ratio as a function of decay time in units of the D0 lifetime, and cKπ′ is the quadratic coefficient, both averaged between the K+π− and K−π+ final states. The precision is improved relative to the previous best measurement by approximately 60%. No evidence for CP violation is found.