Precise optical control of microscopic particles has been mastered over the past three decades, with atoms, molecules and nano-particles now routinely trapped and cooled with extraordinary precision, enabling rapid progress in the study of quantum phenomena. Achieving the same level of control over macroscopic objects is expected to bring further advances in precision measurement, quantum information processing and fundamental tests of quantum mechanics. However, cavity optomechanical systems dominated by radiation pressure - so-called `optical springs' - are inherently unstable due to the delayed dynamical response of the cavity. Here we demonstrate a fully stable, single-beam optical trap for a gram-scale mechanical oscillator. The interaction of radiation pressure with thermo-optic feedback generates damping that exceeds the mechanical loss by four orders of magnitude. The stability of the resultant spring is robust to changes in laser power and detuning, and allows purely passive self-locking of the cavity. Our results open up a new way of trapping and cooling macroscopic objects for optomechanical experiments.