4. If three distinct non-zero real numbers $x$, $y$, $z$ satisfy the relation
$$
x(y-z)=\frac{y(z-x)}{q}=\frac{z(y-x)}{q^{2}},
$$

then the value of $q$ is ( ).
(A) $\frac{-1 \pm \sqrt{5}}{2}$
(B) $\frac{1 \pm \sqrt{5}}{2}$
(C) $\pm \frac{-1+\sqrt{5}}{2}$
(D) $\pm \frac{1-\sqrt{5}}{2}$
4.B.

From the given conditions, we know $q \neq \pm 1$.
By the properties of geometric sequences, we have
$$
\frac{x(y-z)+y(z-x)}{1+q}=\frac{z(y-x)}{q^{2}}.
$$

Also, $x(y-z)+y(z-x)=z(y-x)$, so $1+q=q^{2}$, which simplifies to $q^{2}-q-1=0$. Solving this, we get $q=\frac{1 \pm \sqrt{5}}{2}$.