For arbitrary sets $X \subset \mathbb{R}^{m}, Y \subset \mathbb{R}^{n}$, a function $f: X \to Y$ is, by definition, smooth, if for any $x \in X$ there exists an open neighborhood $x \in U \subset \mathbb{R}^m$ and a smooth function $F: U \to \mathbb{R}^n$ s.t. $F_{|U \cap X} = f_{|U \cap X}$.

So if $z \in Z \subset X$ and $f$ is smooth, then for any $z \in Z$ there exists an open neighborhood $z \in U \subset \mathbb{R}^m$ and a smooth function $F: U \to \mathbb{R}^n$ s.t. $F_{|U \cap X} = f_{|U \cap X}$. Hence, $f_{|Z}$ is smooth.


It really is straightforward. Write $f$ for your smooth map on $X$. You simply need to show that there is an open set $U$ containing $Z$, and a smooth extension of $f$ to $U$. (Incidentally this handles the issue of how to treat isolated points mentioned in the comments.)