Abstract We describe by use of molecular dynamics simulations how the attraction, at short range, between the vortex cores aids the clustering of vortices. Our simulations suggest that the short range core attraction and ensuing vortex clustering is the mechanism responsible for the second peak in the magnetisation loops of superconductors.