In this paper we present a method for the vertical calibration of a metrological atomic force microscope (AFM), which can be applied to most AFM systems with distance sensors. A thorough analysis describes the physical z-coordinate of an imaged surface as a function of the observed and uncorrected z-coordinate and the horizontal position. The three most important correction terms in a Taylor expansion of this function are identified and estimated based on series of measurements on a calibrated step height and a flat reference surface. Based on this calibration a number of step heights are calibrated by the AFM with measured values consistent with reference values, where available. Relative standard uncertainty of about 0.5% is achieved for step heights above 200nm. For step heights below 50nm, the standard uncertainty is about 0.5nm. While a calibration of step heights done by AFM and interference microscopy can be compared directly as demonstrated here, this is not straightforward for roughness measurement. To asses this, the exact same area on an important applied surface (a hip joint prosthesis) was measured by both AFM and interference microscopy. Similarities in the images were seen; however, the calculated roughness was significantly different (Rq=3 and 1.5nm). Applying a low-pass filter with a cut-off wavelength of λc=1.5μm, the appearance of the images and the calculated roughness become almost identical. This strongly suggests that the two methods are consistent, and that the observed differences in shape and roughness in the nanometer range can be explained by the limited lateral resolution of the interference microscope.