Hint 1: if $G$ is non-cyclic group, then $G/Z(G)$ cannot be non-trivial cyclic
Hint 2: any group of order a prime is cyclic
Hint 3 (because of your remark): $G$ is abelian iff $Z(G)=G$
Edit in respond to comments:
Yes, of course. In my answer, since
(1) $\,|Z(G)|=3\,$ and since
(2)$\,G/Z(G)\,$ is abelian,
then $\,G'\leq Z(G)\,$, and since it can't be $\,G'=1\,$ , then it must be $\,G'=Z(G)\,$ of order 3.
Now, it can't be $\,|Z(G)|=9, 27\,$ as then $\,G/Z(G)\,$ would be cyclic non-trivial, something that already was ruled out, or $\,G\,$ would be abelian, and the center cannot be trivial as $\,G\,$ is a p-group, as you mention...
It is not that the center of $\,G\,$ isn't trivial is "too elementary", but rather that it is a very important (or, as Amitzur would put it, the most important) characteristic of finite p-groups, so I suppose most of us assumed anyone asking what you did must already know this.