In order to elucidate the mechanism of cavitation erosion, the dynamics of a single laser-generated cavitation bubble in water and the resulting surface damage on a flat metal specimen are investigated in detail. The characteristic effects of bubble dynamics, in particular the formation of a high-speed liquid jet and the emission of shock waves at the moment of collapse are recorded with high-speed photography with framing rates of up to one million frames/s. Damage is observed when the bubble is generated at a distance less than twice its maximum radius from a solid boundary (γ=2, where γ=s/Rmax, s is the distance between the boundary and the bubble centre at the moment of formation and Rmax is the maximum bubble radius). The impact of the jet contributes to the damage only at small initial distances (γ[les ]0.7). In this region, the impact velocity rises to 83 m s−1, corresponding to a water hammer pressure of about 0.1 GPa, whereas at γ>1, the impact velocity is smaller than 25 m s−1. The largest erosive force is caused by the collapse of a bubble in direct contact with the boundary, where pressures of up to several GPa act on the material surface. Therefore, it is essential for the damaging effect that bubbles are accelerated towards the boundary during the collapse phases due to Bjerknes forces. The bubble touches the boundary at the moment of second collapse when γ<2 and at the moment of first collapse when γ<1. Indentations on an aluminium specimen are found at the contact locations of the collapsing bubble. In the range γ=1.7 to 2, where the bubble collapses mainly down to a single point, one pit below the bubble centre is observed. At γ[les ]1.7, the bubble shape has become toroidal, induced by the jet flow through the bubble centre. Corresponding to the decay of this bubble torus into multiple tiny bubbles each collapsing separately along the circumference of the torus, the observed damage is circular as well. Bubbles in the ranges γ[les ]0.3 and γ=1.2 to 1.4 caused the greatest damage. The overall diameter of the damaged area is found to scale with the maximum bubble radius. Owing to the possibility of generating thousands of nearly identical bubbles, the cavitation resistance of even hard steel specimens can be tested.