Electron spins trapped in quantum dots have been proposed as basic building blocks of a future quantum processor1,2,3. Although fast, 180-picosecond, two-quantum-bit (two-qubit) operations can be realized using nearest-neighbour exchange coupling4, a scalable, spin-based quantum computing architecture will almost certainly require long-range qubit interactions. Circuit quantum electrodynamics (cQED) allows spatially separated superconducting qubits to interact via a superconducting microwave cavity that acts as a ‘quantum bus’, making possible two-qubit entanglement and the implementation of simple quantum algorithms5,6,7. Here we combine the cQED architecture with spin qubits by coupling an indium arsenide nanowire double quantum dot to a superconducting cavity8,9. The architecture allows us to achieve a charge–cavity coupling rate of about 30 megahertz, consistent with coupling rates obtained in gallium arsenide quantum dots10. Furthermore, the strong spin–orbit interaction of indium arsenide allows us to drive spin rotations electrically with a local gate electrode, and the charge–cavity interaction provides a measurement of the resulting spin dynamics. Our results demonstrate how the cQED architecture can be used as a sensitive probe of single-spin physics and that a spin–cavity coupling rate of about one megahertz is feasible, presenting the possibility of long-range spin coupling via superconducting microwave cavities.