Let p be a fixed odd prime. We prove the following results for positive integer solutions
$(x,m,n)$ of the equation
$(*)\ x^2=2^m+p^n$. (i) If
$p \equiv 3 \pmod 8$, then
$(*)$ has only the solution
$(p,x,m,n)=(3,5,4,2)$. (ii) If
$p \equiv 5 \pmod 8$, then
$(*)$ has only the solution
$(p,x,m,n)=(5,3,2,1)$. (iii) If
$p \equiv 7 \pmod 8$, then
$(*)$ has at most one solution
$(x,m,n)$, except for
$p=7$,
$(x,m,n)=(3,1,1)$ and
$(9,5,2)$. Moreover, if
$p=2^q-1$ is a Mersenne prime with
$p>7$, where q is an odd prime with
$q>3$, then
$(*)$ has exactly one solution
$(x,m,n)=(2^q+1,q+2,2)$. If
$p \equiv 7\pmod 8$, p is not a Mersenne prime and either
$p<1.5\times 10^{12}$ or
$p>C$, where C is an effectively computable absolute constant, then
$(*)$ has only the solutions
$p=a^2-2$, where a is an odd positive integer,
$(x,m,n)=(a,1,1)$. (iv) If
$p \equiv 1\pmod 8$ with
$p \ne 17$, then
$(*)$ has at most two solutions
$(x,m,n)$.