Pulsars are rapidly spinning, highly magnetized neutron stars, created in the gravitational collapse of massive stars. We report the detection of pulsed giga-electron volt gamma rays from the young pulsar PSR J0540-6919 in the Large Magellanic Cloud, a satellite galaxy of the Milky Way. This is the first gamma-ray pulsar detected in another galaxy. It has the most luminous pulsed gamma-ray emission yet observed, exceeding the Crab pulsar's by a factor of 20. PSR J0540-6919 presents an extreme test case for understanding the structure and evolution of neutron star magnetospheres.