We present an anisotropic analysis of the baryon acoustic oscillation (BAO) scale in the twelfth and final data release of the Baryon Oscillation Spectroscopic Survey (BOSS). We independently analyse the LOWZ and CMASS galaxy samples: the LOWZ sample contains 361 762 galaxies with an effective redshift of zLOWZ = 0.32; the CMASS sample consists of 777 202 galaxies with an effective redshift of zCMASS = 0.57. We extract the BAO peak position from the monopole power-spectrum moment, α0, and from the μ2 moment, α2, where μ is the cosine of the angle to the line of sight. The μ2-moment provides equivalent information to that available in the quadrupole but is simpler to analyse. After applying a reconstruction algorithm to reduce the BAO suppression by bulk motions, we measure the BAO peak position in the monopole and μ2-moment, which are related to radial and angular shifts in scale. We report H(zLOWZ)rs(zd) = (11.60 ± 0.60) × 103 km s-1 and DA(zLOWZ)/rs(zd) = 6.66 ± 0.16 with a cross-correlation coefficient of rHDA = 0.41, for the LOWZ sample; and H(zCMASS)rs(zd) = (14.56 ± 0.37) × 103 km s-1 and DA(zCMASS)/rs(zd) = 9.42 ± 0.13 with a cross-correlation coefficient of rHDA = 0.47, for the CMASS sample. We demonstrate that our results are not affected by the fiducial cosmology assumed for the analysis. We combine these results with the measurements of the BAO peak position in the monopole and quadrupole correlation function of the same data set (Cuesta et al. 2016, companion paper) and report the consensus values: H(zLOWZ)rs(zd) = (11.63 ± 0.69) × 103 km s-1 and DA(zLOWZ)/rs(zd) = 6.67 ± 0.15 with rHDA = 0.35 for the LOWZ sample; H(zCMASS)rs(zd) = (14.67 ± 0.42) × 103 km s-1 and DA(zCMASS)/rs(zd) = 9.47 ± 0.12 with rHDA = 0.52 for the CMASS sample.