Quantum networking and computing technologies demand scalable hardware with high-speed control for large systems of quantum devices. Solid-state platforms have emerged as promising candidates, offering scalable fabrication for a wide range of qubits. Architectures based on spin–photon interfaces allow for highly connected quantum networks over photonic links, enabling entanglement distribution for quantum networking and distributed quantum computing protocols. With the potential to address these demands, optically active spin defects in silicon are one proposed platform for building quantum technologies. Here we electrically excite the silicon T centre in integrated optoelectronic devices that combine nanophotonic waveguides and cavities with p–i–n diodes. We observe single-photon electroluminescence from a cavity-coupled T centre with g(2)(0) = 0.05(2). Further, we use the electrically triggered emission to herald the electron spin state, initializing it with 92(8)% post-selected fidelity. This shows electrically injected single-photon emission from a silicon colour centre and a new method of heralded spin initialization with electrical excitation. These findings present a new telecommunications-band light source for silicon and a highly parallel control method for T centre quantum processors, advancing the T centre as a versatile defect for scalable quantum technologies.