Following the discovery of long-range antiferromagnetic order in the parent compounds of high-transition-temperature (high-T(c)) copper oxides, there have been efforts to understand the role of magnetism in the superconductivity that occurs when mobile 'electrons' or 'holes' are doped into the antiferromagnetic parent compounds. Superconductivity in the newly discovered rare-earth iron-based oxide systems ROFeAs (R, rare-earth metal) also arises from either electron or hole doping of their non-superconducting parent compounds. The parent material LaOFeAs is metallic but shows anomalies near 150 K in both resistivity and d.c. magnetic susceptibility. Although optical conductivity and theoretical calculations suggest that LaOFeAs exhibits a spin-density-wave (SDW) instability that is suppressed by doping with electrons to induce superconductivity, there has been no direct evidence of SDW order. Here we report neutron-scattering experiments that demonstrate that LaOFeAs undergoes an abrupt structural distortion below 155 K, changing the symmetry from tetragonal (space group P4/nmm) to monoclinic (space group P112/n) at low temperatures, and then, at approximately 137 K, develops long-range SDW-type antiferromagnetic order with a small moment but simple magnetic structure. Doping the system with fluorine suppresses both the magnetic order and the structural distortion in favour of superconductivity. Therefore, like high-T(c) copper oxides, the superconducting regime in these iron-based materials occurs in close proximity to a long-range-ordered antiferromagnetic ground state.