Protons' repulsion within a nucleus

There is an electrostatic repulsion between the protons in the nucleus. However, there is also an attraction due to another kind of force besides electromagnetism, namely the so-called "strong nuclear interaction".

The strong nuclear interaction ultimately boils down to the forces between the "colorful" quarks inside the protons - and neutrons. It is mediated by gluons, much like electromagnetism is mediated by photons, described by Quantum Chromodynamics (QCD), much like electromagnetism is described by Quantum Electrodynamics (QED), and it acts (almost) equally on protons and neutrons.

The attractive strong nuclear interaction inside the nuclei is 1-2 orders of magnitude stronger than the repulsive electrostatic interaction which is what keeps the nuclei together despite the repulsive electrostatic force.