Viruses have two modes spread in a host body, one is to release infectious particles from infected cells (cell-free) and the other is to infect directly from an infected cell to an adjacent cell (cell-to-cell). Since the mode of spread affects the evolution of life history traits, such as virulence, it is important to reveal which mode is selected. Here we show the evolutionarily stable proportion of cell-free and cell-to-cell infection, and how it depends on the spatial distribution of target cells. Using an epidemic model on a 2D regular lattice, we consider the infection dynamics by pair approximation and check the evolutionarily stable strategy. We also conduct the Monte-Carlo simulation to observe evolutionary dynamics. We show that a higher cell-to-cell infection is selected as target cells become clustered. The selected strategy depends not only on the degree of clustering but also the abundance of target cells per se.