We study the conditions for the emergence of cooperation in a spatial common-pool resource game. We consider three types of agents: cooperators, defectors and enforcers. The role of enforcers is to punish defectors for overharvesting the resource. Agents are located around a circle and they only observe the actions of their two nearest neighbors. Their payoffs are determined by both local and global interactions and they modify their actions by imitating the strategy in their neighborhood with the highest payoffs on average. Using theoretical and numerical analysis, we find that a large diversity of equilibria exists in this game. In particular, we derive conditions for the occurrence of equilibria in which the three strategies coexist. We also discuss the stability of these equilibria. Finally, we show that introducing resource dynamics favors the occurrence of cooperative equilibria.