More than 50 years after the discovery of pulsars1 and confirmation of their association with supernova explosions2-4, the origin of the initial spin and velocity of pulsars remains largely a mystery. The typical space velocities of several hundred km s−1 have been attributed to `kicks' resulting from asymmetries either in the supernova ejecta or in the neutrino emission5-7. Observations have shown a strong tendency for alignment between the pulsar space velocity and the spin axis in young pulsars, but until now these comparisons have been restricted to two dimensions. Here, we report evidence for three-dimensional alignment between the spin and velocity vectors, largely based on observations made with the Five-hundred-meter Aperture Spherical Radio Telescope (FAST) of the pulsar PSR J0538+2817 and its associated supernova remnant S147. Analysis of these and related observations has enabled us to determine the location of the pulsar within the supernova remnant and hence its radial velocity. Current simulations of supernova explosions have difficulty producing such three-dimensional alignment7-9. Our results, which depend on the unprecedented sensitivity of the observations, add another dimension to the intriguing correlation between pulsar spin-axis and birth-kick directions, thereby deepening the mysteries surrounding the birth of neutron stars.