A type Ia supernova is thought to be a thermonuclear explosion of either a single carbon-oxygen white dwarf or a pair of merging white dwarfs. The explosion fuses a large amount of radioactive 56Ni (refs 1-3). After the explosion, the decay chain from 56Ni to 56Co to 56Fe generates γ-ray photons, which are reprocessed in the expanding ejecta and give rise to powerful optical emission. Here we report the detection of 56Co lines at energies of 847 and 1,238 kiloelectronvolts and a γ-ray continuum in the 200-400 kiloelectronvolt band from the type Ia supernova 2014J in the nearby galaxy M82. The line fluxes suggest that about 0.6 +/- 0.1 solar masses of radioactive 56Ni were synthesized during the explosion. The line broadening gives a characteristic mass-weighted ejecta expansion velocity of 10,000 +/- 3,000 kilometres per second. The observed γ-ray properties are in broad agreement with the canonical model of an explosion of a white dwarf just massive enough to be unstable to gravitational collapse, but do not exclude merger scenarios that fuse comparable amounts of 56Ni.