We consider the extended Hubbard model and introduce a corresponding Heisenberg-like problem written in terms of spin operators. The derived formalism is reminiscent of Andersons idea of the effective exchange interaction and takes into account nonlocal correlation effects. The results for the exchange interaction and magnetic susceptibility are expressed in terms of single-particle quantities, which can be obtained efficiently in realistic calculations of multiband systems. In the strongly spin-polarized limit, when the local magnetic moment is well-defined, the exchange interaction reduces to a standard expression of the density functional theory that has been successfully used in practical calculations of magnetic properties of real materials.