The interplay of magnetic and charge fluctuations can lead to quantum phases
with exceptional electronic properties. A case in point is magnetically-driven
superconductivity, where magnetic correlations fundamentally affect the
underlying symmetry and generate new physical properties. The superconducting
wave-function in most known magnetic superconductors does not break
translational symmetry. However, it has been predicted that modulated triplet
p-wave superconductivity occurs in singlet d-wave superconductors with
spin-density wave (SDW) order. Here we report evidence for the presence of a
spatially inhomogeneous p-wave Cooper pair-density wave (PDW) in CeCoIn5. We
show that the SDW domains can be switched completely by a tiny change of the
magnetic field direction, which is naturally explained by the presence of
triplet superconductivity. Further, the Q-phase emerges in a common
magneto-superconducting quantum critical point. The Q-phase of CeCoIn5 thus
represents an example where spatially modulated superconductivity is associated
with SDW order