A two‐dimensional fully electromagnetic particle‐in‐cell code is used to simulate the interaction of a relativistic electron beam injected into a finite‐size background neutral plasma. The simulations show that the background electrons are pushed away from the beam path, forming a neutralizing ion channel. Soon after the beam head leaves the plasma, a virtual cathode forms which travels away with the beam. However, at later times a second, quasi‐stationary, virtual cathode forms. Its position and strength depends critically on the parameters of the system which critically determines the efficiency of the ion acceleration process. The background ions trapped in the electrostatic well of the virtual cathode are accelerated and at later times, the ions as well as the virtual cathode drift away from the plasma region. The surfing of the ions in the electrostatic well produces an ion population with energies several times the initial electron beam energy. It is found that optimum ion acceleration occurs when the beam‐to‐plasma density ratio is near unity. When the plasma is dense, the beam is a weak perturbation and accelerates few ions, while when the plasma is tenuous, the beam is not effectively neutralized, and a virtual cathode occurs right at the injection plane. The simulations also show that, at the virtual cathode position, the electron beam is pinched producing a self‐focusing phenomena.