Let $\mathfrak{P}$ be a prime ideal of $\mathbb{Z}[x]$. Then $\mathfrak{P}\cap\mathbb{Z}$ is a prime ideal of $\mathbb{Z}$: this holds whenever $R\subseteq S$ are commutative rings. Indeed, if $a,b\in R$, $ab\in R\cap P$, then $a\in P$ or $b\in P$ (since $P$ is prime). (More generally, the contraction of a prime ideal is always a prime ideal, and $\mathfrak{P}\cap\mathbb{Z}$ is the contraction of $\mathfrak{P}$ along the embedding $\mathbb{Z}\hookrightarrow\mathbb{Z}[x]$).

Thus, we have two possibilities: $\mathfrak{P}\cap\mathbb{Z}=(0)$, or $\mathfrak{P}\cap\mathbb{Z}=(p)$ for some prime integer $p$.

**Case 1.** $\mathfrak{P}\cap\mathbb{Z}=(0)$. If $\mathfrak{P}=(0)$, we are done; otherwise, let $S=\mathbb{Z}-\{0\}$. Then $S\cap \mathfrak{P}=\varnothing$, $S$ is a multiplicative set, so we can localize $\mathbb{Z}[x]$ at $S$ to obtain $\mathbb{Q}[x]$; the ideal $S^{-1}\mathfrak{P}$ is prime in $\mathbb{Q}[x]$, and so is of the form $(q(x))$ for some irreducible polynomial $q(x)$. Clearing denominators and factoring out content we may assume that $q(x)$ has integer coefficients and the gcd of the coefficients is $1$.

I claim that $\mathfrak{P}=(q(x))$. Indeed, from the theory of localizations, we know that $\mathfrak{P}$ consists precisely of the elements of $\mathbb{Z}[x]$ which, when considered to be elements of $\mathbb{Q}[x]$, lie in $S^{-1}\mathfrak{P}$. That is, $\mathfrak{P}$ consists precisely of the rational multiples of $q(x)$ that have integer coefficients. In particular, every integer multiple of $q(x)$ lies in $\mathfrak{P}$, so $(q(x))\subseteq \mathfrak{P}$. But, moreover, if $f(x)=\frac{r}{s}q(x)\in\mathbb{Z}[x]$, then $s$ divides all coefficients of $q(x)$; since $q(x)$ is primitive, it follows that $s\in\{1,-1\}$, so $f(x)$ is actually an *integer* multiple of $q(x)$. Thus, $\mathfrak{P}\subseteq (q(x))$, proving equality.

Thus, if $\mathfrak{P}\cap\mathbb{Z}=(0)$, then either $\mathfrak{P}=(0)$, or $\mathfrak{P}=(q(x))$ where $q(x)\in\mathbb{Z}[x]$ is irreducible.

**Case 2.** $\mathfrak{P}\cap\mathbb{Z}=(p)$.

We can then consider the image of $\mathfrak{P}$ in $\mathbb{Z}[x]/(p)\cong\mathbb{F}_p[x]$. The image is prime, since the map is onto; the prime ideals of $\mathbb{F}_p[x]$ are $(0)$ and ideals of the form $(q(x))$ with $q(x)$ monic irreducible over $\mathbb{F}_p[x]$. If the image is $(0)$, then $\mathfrak{P}=(p)$, and we are done.

Otherwise, let $p(x)$ be a polynomial in $\mathbb{Z}[x]$ that reduces to $q(x)$ modulo $p$ and that is monic. Note that $p(x)$ must be irreducible in $\mathbb{Z}[x]$, since any nontrivial factorization in $\mathbb{Z}[x]$ would induce a nontrivial factorization in $\mathbb{F}_p[x]$ (since $p(x)$ and $q(x)$ are both monic).

I claim that $\mathfrak{P}=(p,p(x))$. Indeed, the isomorphism theorems guarantee that $(p,p(x))\subseteq \mathfrak{P}$. Conversely, let $r(x)\in\mathfrak{P}(x)$. Then there exists a polynomial $s(x)\in\mathbb{F}_p[x]$ such that $s(x)q(x) = \overline{r}(x)$. If $t(x)$ is any polynomial that reduces to $s(x)$ modulo $p$, then $t(x)p(x)-r(x)\in (p)$, hence there exists a polynomial $u(x)\in\mathbb{Z}[x]$ such that $r(x) = t(x)p(x)+pu(x)$. Therefore, $r(x)\in (p,p(x))$, hence $\mathfrak{P}\subseteq (p,p(x))$, giving equality.

Thus, if $\mathfrak{P}\cap\mathbb{Z}[x]=(p)$ with $p$ a prime, then either $\mathfrak{P}=(p)$ or $\mathfrak{P}=(p,p(x))$ with $p(x)\in\mathbb{Z}[x]$ irreducible.

This proves the desired classification.