The strategy is: first show $G$ is abelian (using the centre), then classify by element orders.
**Step 1: $G$ is abelian.**
By the [Centre of a p-Group Is Nontrivial](/theorems/799) theorem, $Z(G) \neq \{e\}$. Since $Z(G) \leq G$ and $|G| = p^2$, [Lagrange's Theorem](/theorems/782) gives $|Z(G)| \in \{p, p^2\}$. Therefore $|G/Z(G)| \in \{p, 1\}$. In either case, $G/Z(G)$ is cyclic (a [group](/page/Group) of prime order is cyclic by [Prime Order Implies Cyclic](/theorems/784), and the trivial group is cyclic). By [Cyclic Quotient by Centre Implies Abelian](/theorems/800), $G$ is abelian.
**Step 2: Case 1 — an element of order $p^2$ exists.**
If there exists $g \in G$ with $o(g) = p^2$, then $G = \langle g \rangle \cong C_{p^2}$.
**Step 3: Case 2 — all non-identity elements have order $p$.**
Suppose no element has order $p^2$. By [Element Order Divides Group Order](/theorems/783), every non-identity element has order $p$. Pick $a \neq e$; then $\langle a \rangle \cong C_p$. Pick $b \in G \setminus \langle a \rangle$; then $\langle b \rangle \cong C_p$.
[claim:Direct Product Decomposition]
$G \cong \langle a \rangle \times \langle b \rangle \cong C_p \times C_p$.
[/claim]
[proof]
Since $G$ is abelian, every subgroup is normal, so $\langle a \rangle \unlhd G$ and $\langle b \rangle \unlhd G$. We have $\langle a \rangle \cap \langle b \rangle = \{e\}$: any element in the intersection has order dividing both $p$ and $p$, but if $a^i = b^j$ with $a^i \neq e$, then $b^j \in \langle a \rangle$, so $b \in \langle a \rangle$ (since $\gcd(j, p) = 1$ implies $b = (b^j)^{j^{-1}} \in \langle a \rangle$), contradicting $b \notin \langle a \rangle$. The element-wise product $\langle a \rangle \langle b \rangle$ has $|\langle a \rangle||\langle b \rangle|/|\langle a \rangle \cap \langle b \rangle| = p^2 = |G|$ elements, so $\langle a \rangle \langle b \rangle = G$. By the [Internal Direct Product Theorem](/theorems/794), $G \cong \langle a \rangle \times \langle b \rangle \cong C_p \times C_p$.
[/proof]