  We consider $(M,g)$ a smooth compact Riemannian manifold of dimension $n \geq
2$ without boundary, $1 < p$ a real parameter and $r = \frac{p(n + p)}{n}$.
This paper concerns the validity of the optimal Moser inequality
  \[ \left(\int_M |u|^r\; dv_g \right)^{\frac{\tau}{p}} \leq \left(
A(p,n)^{\frac{\tau}{p}} \left(\int_M |\nabla_g u|^p\;
dv_g\right)^{\frac{\tau}{p}} + B_{opt} \left(\int_M |u|^p\;
dv_g\right)^{\frac{\tau}{p}} \right) \left( \int_M |u|^p\; dv_g
\right)^{\frac{\tau}{n}} \; . \]
  This kind of inequality was already studied in the last years in the
particular cases $1 < p < n$. Here we solve the case $n \leq p$ and we
introduce one more parameter $1 \leq \tau \leq \min\{p,2\}$. Moreover, we prove
the existence of an extremal function for the optimal inequality above.
