The instabilities of the native structures of mutant proteins with an amino acid exchange are estimated by using the contact energy and the number of contacts for each type of amino acid pair, which were estimated from 18 192 residue - residue contacts observed in 42 crystals of globular proteins. They were then used to evaluate a transition probability matrix of codon substitutions and a log relatedness odds matrix, which is used as a scoring matrix to measure the similarity between protein sequences. To consider amino acid substitutions in homologous proteins, base mutation rates and the effects of the genetic code are also taken into account. The average fitness of an amino acid exchange is approximated to be proportional to the structural stability of the mutant protein, which is then approximated by the average energy change of the protein native structure expected for the amino acid exchange with neglect of the energy change of the denatured state. In global and local homology searches, this scoring matrix tends to yield significantly higher alignment scores than either the unitary matrix or the genetic code matrix, and also may yield higher alignment scores for distantly related protein pairs than MDM78. One of advantages of this scoring matrix is that the equilibrium frequencies of codons and also base mutation rates can be adjusted.