Assume that there is a cover $(U_i)_{i\in I}$ of $X$ such that $Z\cap U_i$ is closed in $U_i$ for each $i$. Then
$$X-Z=(X-Z)\cap\bigcup U_i=\bigcup (U_i-Z)$$
Now $U_i-Z$ is open in $U_i$, thus open in $X$. So the complement of $Z$ is open in $X$.
The other direction is trivial.
By the way: If $(U_i)_I$ is an open cover, then $C$ is closed/open if (we have just shown that) and only if $C\cap U_i$ is closed/open in $U_i$. More generally, this holds when the $U_i$ are neighborhoods, i.e. when each point has some $U_i$ as a neighborhood. One then says that
$(X,\tau)$ is coherent with $(U_i)_I$