We present a new analysis of a 9-d long XMM–Newton monitoring of the narrow-line Seyfert 1 galaxy Mrk 766. We show that the strong changes in the spectral shape, which occurred during this observation, can be interpreted as due to broad-line region clouds crossing the line of sight to the X-ray source. Within the occultation scenario, the spectral and temporal analyses of the eclipses provide precise estimates of the geometrical structure, location and physical properties of the absorbing clouds. In particular, we show that these clouds have cores with column densities of at least a few 1023 cm−2 and velocities in the plane of the sky of the order of thousands of km s−1. The three different eclipses monitored by XMM–Newton suggest a broad range in cloud velocities (by a factor of ∼4–5). Moreover, two iron absorption lines clearly associated with each eclipse suggest the presence of highly ionized gas around the obscuring clouds and an outflow component of the velocity spanning from 3000 to 15 000 km s−1.