With the goal of developing predictive ab initio capability for light and medium-mass nuclei, two-nucleon and three-nucleon forces from chiral effective field theory are optimized simultaneously to low-energy nucleon-nucleon scattering data, as well as binding energies and radii of few-nucleon systems and selected isotopes of carbon and oxygen. Coupled-cluster calculations based on this interaction, named ${\mathrm{NNLO}}_{\mathrm{sat}}$, yield accurate binding energies and radii of nuclei up to $^{40}\mathrm{Ca}$, and are consistent with the empirical saturation point of symmetric nuclear matter. In addition, the low-lying collective ${J}^{\ensuremath{\pi}}={3}^{\ensuremath{-}}$ states in $^{16}\mathrm{O}$ and $^{40}\mathrm{Ca}$ are described accurately, while spectra for selected $p$- and $sd$-shell nuclei are in reasonable agreement with experiment.