When analyzing surfaces related to biosensors with in situ atomic force microscopy (AFM), the existence of nanobubbles called for our attention. The bubbles seem to form spontaneously when gold surfaces are immersed in clean water and are probably a general phenomenon at water-solid interfaces. Besides from giving rise to undesired effects in, for example, biosensors, nanobubbles can also cause artifacts in AFM imaging. We have observed nanobubbles on unmodified gold surfaces, immersed in clean water, using standard silicon AFM probes. Nanobubbles can be made to disappear from contact mode AFM images and then to reappear by changing the scanning force. By combining contact mode AFM imaging and local force measurements, the interaction between the nanobubbles and the probe can be analyzed and give information about the characteristics of nanobubbles. A model of the forces between the AFM probe tip and the nanobubble indicates that a small tip cone angle and a relatively hydrophilic tip surface makes it possible to image nanobubbles with contact mode AFM even though the tip has penetrated the surface of the bubble.