The evolution of cooperation in spatial groups