A spatially explicit plant–herbivore model composed of planktonic herbivores, algal preys and nutrients was constructed to examine the effects of consumer-driven nutrient recycling (CNR) on the algal species richness with and without spatial structure. The model assumed that either of two essential nutrients (N and P) limited growth of algal populations and that consumer individuals moved randomly in the lattice and grazed all the algal species with the same efficiency. The results showed that when there was no CNR, the number of persistent algal species was affected by neither supply rates of external nutrients nor spatial structure and was consistently low. When consumers recycled nutrients according to their stoichiometry, the algal species richness changed with supply rates of external nutrients depending on spatial structure: the algal species richness decreased with increasing nutrient loadings when there were no spatial structure because CNR increased the probability of stochastic extinction of algal species by amplifying the oscillation of algae-consumer dynamics. However, when spatial structures were created by the migration of consumers, CNR increased the algal species richness in a range of nutrient loadings because spatial variation of grazing pressure functioned to stabilize the algal-consumer dynamics. The present study suggests that through grazing and nutrient recycling, consumer individuals can create ephemeral heterogeneity in growth environments for algal species and that this ephemerality is one of the keys to understanding algal species in nature.