The tip and the conducting substrate in tunneling microscopy form a capacitor. Similarly, in electrochemistry of polarized electrode the metal and the electrolyte form a double layer capacitor. It is shown that the energetics of these two capacitors, namely the surface tension of the substrate and of the polarized electrode, respectively, are governed by the same relationship, the Gibbs-Lippmann equation. The implications of this finding for STM imaging are discussed.