Nuclear magic numbers, which emerge from the strong nuclear force based on quantum chromodynamics, correspond to fully occupied energy shells of protons, or neutrons inside atomic nuclei. Doubly magic nuclei, with magic numbers for both protons and neutrons, are spherical and extremely rare across the nuclear landscape. While the sequence of magic numbers is well established for stable nuclei, evidence reveals modifications for nuclei with a large proton-to-neutron asymmetry. Here, we provide the first spectroscopic study of the doubly magic nucleus $^{78}$Ni, fourteen neutrons beyond the last stable nickel isotope. We provide direct evidence for its doubly magic nature, which is also predicted by ab initio calculations based on chiral effective field theory interactions and the quasi-particle random-phase approximation. However, our results also provide the first indication of the breakdown of the neutron magic number 50 and proton magic number 28 beyond this stronghold, caused by a competing deformed structure. State-of-the-art phenomenological shell-model calculations reproduce this shape coexistence, predicting further a rapid transition from spherical to deformed ground states with $^{78}$Ni as turning point.