Given that $p = a^2 - ab + b^2$, we can factor over $\mathbb{Z}[\zeta_3]$ (ring of Eisenstein integers) to obtain $p = \left(a + \zeta_3b\right)\left(a + \zeta_3^2b\right)$.
Therefore the ideal $(p)$ is not inert over $\mathbb{Z}[\zeta_3]$.
Then by the Dedekind factorization theorem we must have that $X^2 + X + 1$ splits into linear factors in $\mathbb{F}_p[X]$, i.e. there are roots in $\mathbb{F}_p$.
But the roots are formally $\frac{-1 \pm \sqrt{-3}}{2}$, so $-3$ must be a perfect square mod $p$. By quadratic reciprocity, this means that $p \equiv 1 \pmod 3$ as desired.
The converse is also true: given that $p \equiv 1 \pmod 3$ we use quadratic reciprocity to show that $-3$ is a perfect square mod $p$. Then the roots $\frac{-1 \pm \sqrt{-3}}{2}$ of the minimal polynomial $X^2 + X + 1$ are in $\mathbb{F}_p$, so $X^2 + X + 1$ splits in $\mathbb{F}_p[X]$.
By the Dedekind factorization theorem, the ideal $(p)$ factors into a product of two prime ideals in $\mathbb{Z}[\zeta_3]$. Since $\mathbb{Z}[\zeta_3]$ is a PID, we can write $(p) = (\alpha)(\beta) = (\alpha\beta)$, then it follows that $p = u\alpha\beta$ for some $\alpha, \beta \in \mathbb{Z}[\zeta_3]$ nonunits and $u$ some unit.
Finally taking norms we must have $N_{\mathbb{Q}(\zeta_3)/\mathbb{Q}}(\alpha) = p$, so $p$ is the norm of $\alpha = a + b\zeta_3$, which is $a^2 - ab + b^2$.