We study a system of equations on a compact complex manifold, that couples the scalar curvature of a Kahler metric with a spectral function of a first-order deformation of the complex structure. The system comes from an infinite-dimensional Kahler reduction, which is a hyperkahler reduction for a particular choice of the spectral function. The main tool for studying the system is a flat connection on the space of first-order deformations of the complex structure, that allows to obtain a formal complexification of the moment map equations. Using this connection, we describe a variational characterization of the equations, a Futaki invariant for the system, and a generalization of K-stability that is conjectured to characterize the existence of solutions.