Many bosons can occupy a single quantum state without a limit. It is described by the quantum-mechanical Bose–Einstein statistic, which allows Bose–Einstein condensation at low temperatures and high particle densities. Photons, historically the first considered bosonic gas, were late to show this phenomenon, observed in rhodamine-filled microcavities and doped fibre cavities. These findings have raised the question of whether condensation is also common in other laser systems with potential technological applications. Here we show the Bose–Einstein condensation of photons in a broad-area vertical-cavity surface-emitting laser with a slight cavity-gain spectral detuning. We observed a Bose–Einstein condensate in the fundamental transversal optical mode at a critical phase-space density. The experimental results follow the equation of state for a two-dimensional gas of bosons in thermal equilibrium, although the extracted spectral temperatures were lower than the device’s. This is interpreted as originating from the driven-dissipative nature of the photon gas. In contrast, non-equilibrium lasing action is observed in the higher-order modes in more negatively detuned device. Our work opens the way for the potential exploration of superfluid physics of interacting photons mediated by semiconductor optical nonlinearities. It also shows great promise for enabling single-mode high-power emission from a large-aperture device.