A new family of superconductors containing layers of iron arsenide1, 2, 3 has attracted considerable interest because of their high transition temperatures (Tc), some of which are >50 K, and because of similarities with the high-Tc copper oxide superconductors. In both the iron arsenides and the copper oxides, superconductivity arises when an antiferromagnetically ordered phase has been suppressed by chemical doping4. A universal feature of the copper oxide superconductors is the existence of a resonant magnetic excitation, localized in both energy and wavevector, within the superconducting phase5, 6, 7, 8, 9. This resonance, which has also been observed in several heavy-fermion superconductors10, 11, 12, is predicted to occur when the sign of the superconducting energy gap takes opposite values on different parts of the Fermi surface13, an unusual gap symmetry which implies that the electron pairing interaction is repulsive at short range14. Angle-resolved photoelectron spectroscopy shows no evidence of gap anisotropy in the iron arsenides, but such measurements are insensitive to the phase of the gap on separate parts of the Fermi surface15. Here we report inelastic neutron scattering observations of a magnetic resonance below Tc in Ba0.6K0.4Fe2As2, a phase-sensitive measurement demonstrating that the superconducting energy gap has unconventional symmetry in the iron arsenide superconductors.