Microquasars are stellar-mass black holes accreting matter from a companion star and ejecting plasma jets at almost the speed of light. They are analogues of quasars that contain supermassive black holes of 10(6) to 10(10) solar masses. Accretion in microquasars varies on much shorter timescales than in quasars and occasionally produces exceptionally bright X-ray flares. How the flares are produced is unclear, as is the mechanism for launching the relativistic jets and their composition. An emission line near 511 kiloelectronvolts has long been sought in the emission spectrum of microquasars as evidence for the expected electron-positron plasma. Transient high-energy spectral features have been reported in two objects, but their positron interpretation remains contentious. Here we report observations of γ-ray emission from the microquasar V404 Cygni during a recent period of strong flaring activity. The emission spectrum around 511 kiloelectronvolts shows clear signatures of variable positron annihilation, which implies a high rate of positron production. This supports the earlier conjecture that microquasars may be the main sources of the electron-positron plasma responsible for the bright diffuse emission of annihilation γ-rays in the bulge region of our Galaxy. Additionally, microquasars could be the origin of the observed megaelectronvolt continuum excess in the inner Galaxy.