Although the origin of high temperature superconductivity in the iron pnictides is still under debate, it is widely believed that magnetic interactions or fluctuations have a crucial role in triggering Cooper pairing. A key issue regarding the iron pnictide phase diagram is whether long-range magnetic order can coexist with superconductivity microscopically. Here we use scanning tunnelling microscopy to investigate the local electronic structure of underdoped NaFe 1 À x Co x As near the spin density wave and superconducting phase boundary. Spatially resolved spectroscopy directly reveals both the spin density wave and superconducting gaps at the same atomic location, providing compelling evidence for the microscopic coexistence of the two phases. The strengths of the two orders are shown to anti-correlate with each other, indicating the competition between them. This work implies that Cooper pairing in the iron pnictides can occur when portions of the Fermi surface are already gapped by the spin density wave order.