A search for top squark pair production in pp collisions at sqrt(s) = 13 TeV is performed using events with a single isolated electron or muon, jets, and a large transverse momentum imbalance. The results are based on data collected in 2016 with the CMS detector at the LHC, corresponding to an integrated luminosity of 35.9 inverse femtobarns. No significant excess of events is observed above the expectation from standard model processes. Exclusion limits are set in the context of supersymmetric models of pair production of top squarks that decay either to a top quark and a neutralino or to a bottom quark and a chargino. Depending on the details of the model, we exclude top squarks with masses as high as 1120 GeV. Detailed information is also provided to facilitate theoretical interpretations in other scenarios of physics beyond the standard model.