A modified flocking model with virtual leaders is proposed, and then a clustering algorithm based on it is developed. In the algorithm, firstly a weighted and undirected graph is established by all data points in a dataset according to the model, where each data point is regarded as an agent who can move in space. Then a set of virtual leaders are identified, from whichvirtual leaders are chosen and linked by each data point. Furthermore, each data point is acted by all linked data points through fields established by them in space, so it will take a step along the direction of the vector sum of all fields. Thanks to those virtual leaders, they accelerate the rate of convergence of the algorithm. As all data points move in space according to the proposed model, data points that belong to the same class are located at a same position, whereas those that belong to other classes are away from one another. Consequently, the experimental results demonstrate that data points in datasets are clustered reasonably and efficiently, and in several iterations the convergence of the algorithm will be reached. Moreover, the comparison with other algorithms also provides an indication of the effectiveness of proposed approach.