High-temperature superconductivity occurs as copper oxides are chemically tuned to have a carrier concentration intermediate between their metallic state at high doping and their insulating state at zero doping. The underlying evolution of the electron system in the absence of superconductivity is still unclear and a question of central importance is whether it involves any intermediate phase with broken symmetry. The Fermi surface of underdoped YBa2Cu3Oy and YBa2Cu4O8 was recently shown to include small pockets in contrast with the large cylinder characteristic of the overdoped regime1, pointing to a topological change in the Fermi surface. Here we report the observation of a negative Hall resistance in the magnetic field-induced normal state of YBa2Cu3Oy and YBa2Cu4O8, which reveals that these pockets are electron-like. We propose that electron pockets arise most likely from a reconstruction of the Fermi surface caused by the onset of a density-wave phase, as is thought to occur in the electron-doped materials near the onset of antiferromagnetic order Comparison with materials of the La2CuO4 family that exhibit spin/charge density-wave order suggests that a Fermi surface reconstruction also occurs in those materials, pointing to a generic property of high-Tc superconductors.