In this paper, a novel general purpose clustering algorithm is presented, based on the watershed algorithm. The proposed approach defines a density function on a suitable lattice, whose cell dimension is carefully estimated from the data. The clustering is then performed using the well-known watershed algorithm, paying particular attention to the boundary situations. The main characteristic of this method is the capability to determine automatically the number of clusters from the data, resulting in a completely unsupervised approach. Experimental evaluation on synthetic data shows that the proposed approach is able to accurately estimate the number of the classes and to cluster data effectively.