Localization and duality in topology and modular representation theory David J. Benson and J. P. C. Greenlees \begin{abstract} We develop a duality theory for localizations in the context of ring spectra in algebraic topology. We apply this to prove a theorem in the modular representation theory of finite groups. Let $G$ be a finite group and $k$ be an algebraically closed field of characteristic $p$. If $\p$ is a homogeneous nonmaximal prime ideal in $H^*(G,k)$, then there is an idempotent module $\kappa_\p$ which picks out the layer of the stable module category corresponding to $\p$, and which was used by Benson, Carlson and Rickard \cite{Benson/Carlson/Rickard:1997a} in their development of varieties for infinitely generated $kG$-modules. Our main theorem states that the Tate cohomology $\hat H^*(G,\kappa_\p)$ is a shift of the injective hull of $H^*(G,k)/\p$ as a graded $H^*(G,k)$-module. Since $\kappa_\p$ can be constructed using a version of the stable Koszul complex, this can be viewed as a statement of localized Gorenstein duality in modular representation theory. Various consequences of this theorem are given, including the statement that the stable endomorphism ring of the module $\kappa_\p$ is the $\p$-completion of cohomology $H^*(G,k)\phat$, and the statement that $\kappa_\p$ is a pure injective $kG$-module. In the course of proving the theorem, we further develop the framework introduced by \DGI\ for translating between the unbounded derived categories $\D(kG)$ and $\D(C^*(BG;k))$. We also construct a functor $\Psi\colon \D(kG) \ra \StMod(kG)$ to the full stable module category, which extends the usual functor $\D^b(kG) \ra \stmod(kG)$ and which preserves Tate cohomology. The main theorem is formulated and proved in $\D(C^*(BG;k))$, and then translated to $\D(kG)$ and finally to $\StMod(kG)$. The main theorem in $\D(C^*(BG;k))$ can be viewed as stating that a version of Gorenstein duality holds after localizing at a prime ideal in $H^*(BG;k)$. This version of the theorem holds more generally for a compact Lie group satisfying a mild orientation condition. This duality lies behind the local cohomology spectral sequence of Greenlees and Lyubeznik for localizations of $H^*(BG;k)$.\vspace{-5mm} \end{abstract}