Optoacoustic tomography (OAT) is a hybrid imaging modality that combines optical excitation with ultrasound detection and enables high-resolution visualization of optical contrasts at tissue depths in which light is completely diffused. Despite its promise in numerous research and clinical applications, OAT is limited by the technological immaturity of ultrasound detection systems. It suffers from limited element count, narrow field of view and lack of technology for spatial modulation of acoustic signals. Here we report single-detector OAT capable of high-fidelity imaging using an amplitude mask in planar geometry coded with cyclic patterns for structured spatial acoustic modulation. Our image reconstruction method maximises sensitivity, is compatible with planar signal detection, and uses only linear operations, thus avoiding artefacts associated with the nonlinear compressed-sensing inversion. We demonstrate our method for 3D OAT of complex objects and living tissue performed with only a single ultrasound detector, effectively coded into a 2D array with 1763 elements. Our method paves the way for a new generation of high-fidelity, low-cost OAT systems.