A fully relativistic approach to evaluating the correlation effects in highly charged ions is presented. The interelectronic-interaction contributions of first and second orders in 1/Z are treated rigorously within the framework of bound-state quantum electrodynamics, whereas the calculations of the third- and higher-order contributions are based on the Dirac-Coulomb-Breit Hamiltonian. The developed approach allows one to deal with single as well as degenerate or quasidegenerate states. We apply this approach to the calculations of the correlation contributions to the n = 1 and n = 2 energy levels in helium like ions. The obtained contributions are combined with the one-electron QED, screened QED, nuclear recoil, and nuclear polarization corrections to get the total theoretical predictions for the ionization and transition energies in high-Z helium like ions.