The metastable first excited state of thorium-229, 229mTh, is just a few electronvolts above the nuclear ground state1-4 and is accessible by vacuum ultraviolet lasers. The ability to manipulate the 229Th nuclear states with the precision of atomic laser spectroscopy5 opens up several prospects6, from studies of fundamental interactions in physics7,8 to applications such as a compact and robust nuclear clock5,9,10. However, direct optical excitation of the isomer and its radiative decay to the ground state have not yet been observed, and several key nuclear structure parameters-such as the exact energies and half-lives of the low-lying nuclear levels of 229Th-remain unknown11. Here we present active optical pumping into 229mTh, achieved using narrow-band 29-kiloelectronvolt synchrotron radiation to resonantly excite the second excited state of 229Th, which then decays predominantly into the isomer. We determine the resonance energy with an accuracy of 0.07 electronvolts, measure a half-life of 82.2 picoseconds and an excitation linewidth of 1.70 nanoelectronvolts, and extract the branching ratio of the second excited state into the ground and isomeric state. These measurements allow us to constrain the 229mTh isomer energy by combining them with γ-spectroscopy data collected over the past 40 years.