The observation of nanoscale deformation in real time is a significant step toward understanding the mechanisms of friction and lubrication. Our experimental setup of a micromachine combined with a transmission electron microscope allowed us to measure the deformation, force and cross-sectional area of a single Ag asperity during shear testing. The experimental results provided insight into one of the parameters that determines the frictional coefficient. Furthermore, we demonstrated that the energy loss associated with a shear fracture event is strongly correlated with the increase in total surface energy of the two surfaces formed here after the fracture of the nanocontact.