The interaction of magnetic order and ferroelectric polarization is a fundamental coupling with the prospect for the control of electronic properties and magnetism. The connection among magnetic order, charge localization and associated metal-insulator transition (MIT) is another cornerstone for materials control. Materials that combine both effects are therefore of great interest but so far not established. One of the classes of materials proposed to combine these functionalities is the family of RNiO3 (R: lanthanide or Y), whose members show a clear MIT and an antiferromagnetic ground state, and for which an electric polarization has been predicted. Here, we show by resonant magnetic x-ray scattering with circular polarization that YNiO3 does not only possess a magnetic structure containing domains of spin-rotations that are consistent with the occurrence of electric polarization, but also that there is a significant magnetoelectric interaction that allows manipulation of magnetic domains by an electric field. This shows that charge ordered RNiO3 are magnetoelectric multiferroics with a MIT.