A magnetic vortex is a curling magnetic structure realized in a ferromagnetic disk, which is a promising candidate of a memory cell for future nonvolatile data storage devices. Thus, understanding of the stability and dynamical behaviour of the magnetic vortex is a major requirement for developing magnetic data storage technology. Since the experimental proof of the existence of a nanometre-scale core with out-of-plane magnetisation in the magnetic vortex, the dynamics of a vortex has been investigated intensively. However, the way to electrically control the core magnetisation, which is a key for constructing a vortex core memory, has been lacking. Here, we demonstrate the electrical switching of the core magnetisation by utilizing the current-driven resonant dynamics of the vortex; the core switching is triggered by a strong dynamic field which is produced locally by a rotational core motion at a high speed of several hundred m/s. Efficient switching of the vortex core without magnetic field application is achieved thanks to resonance. This opens up the potentiality of a simple magnetic disk as a building block for spintronic devices like a memory cell where the bit data is stored as the direction of the nanometre-scale core magnetisation.