A new method is described for obtaining effective pair interactions (EPI) in transition-metal alloys from density-functional-theory total-energy calculations for supercell compounds. The calculated total energies are used to obtain explicit concentration-independent cluster interactions, through an inversion scheme [J. W. D. Connolly and A. R. Williams, Phys. Rev. B 27, 5168 (1983)]. Using a truncated form for the higher-order interatomic correlation functions, the cluster interactions are resummed into concentration-dependent EPI. The EPI are interpreted within the established perturbation-theoretic framework. The method offers a treatment of electron-electron interactions that is more accurate than in existing perturbative methods, although the long-ranged oscillations in the EPI are much more difficult to obtain. Furthermore, the method can be used with density-functional calculations which supersede the muffin-tin approximation, and can generate a variety of types of EPI depending upon the particular truncation scheme employed. Results are presented for the Ni-Al and Nb-Y systems. In Ni-Al the EPI is strongly concentration dependent, with the ordering tendency much stronger at the Ni-rich end. The elastic strain energy contributes significantly to the ordering energy. In Nb-Y the EPI favors phase separation most strongly at the Nb-rich end of the phase diagram.