First of all, the electrons do exert a repulsive force on one another. This is inherently accounted for in the electrostatic repulsion terms in the atomic Hamiltonian that is used to solve the Schrödinger equation numerically. The fact that electrons will pair up is just a result of the fact that these states are the most optimal ones possible, despite this repulsion. I will treat this question at a rather basic level by hand waving away the fact that changing the electron configuration changes the energies of the electron levels. Instead, I will act as if there were orbital energy levels "already there" and we are just trying to decide how to fill them by considering effects like pair repulsion.
For a rather obvious example, take the He atom. Despite the fact that there is obvious pair repulsion associated to both electrons being in the $1s$ spatial orbital, the cost of promoting an electron to the $2s$ orbital to avoid this repulsion is unreasonably high, and so the spin paired electrons are the most stable configuration. It is also noteworthy that despite the fact that the electron repulsion is fairly strong in more spatially compressed orbitals, the energy levels of the orbitals are also highly stable in the first place.
To see a practical example of how electron repulsion can affect the relative stability of different electron configurations, one can look at the transition metals of the periodic table. Despite the fact that the $4s$ state is nominally lower in energy than the neighboring $3d$ state, the valence electrons in a Cr atom adopt a $4s^13d^5$ configuration. This is because spreading out the electrons in distinct spatial orbitals lowers the overall energy of the atom more than simply putting the electrons in the lowest energy orbitals. But the energy savings gained by avoiding pair repulsion is relatively small, and the associated levels need to be rather close in energy for this to outweigh the cost associated to promoting an electron to a higher shell or subshell. In fact, as we go to higher energy shells, the energy associated to pair repulsion generally decreases due to the larger spatial spread of these electron orbitals.
The issues of spin are many and highly complicated, so I will not attempt to flesh that out here. I will just point out that your final question is a bit confused, as the spin does not "counteract" the repulsive force in any way. The spin is just the spin, and for complex reasons it has to do with what states are allowed in the first place (i.e. electrons in the same spatial orbital must have opposite spins).