From Rudin's Principles of Mathematical Analysis (p.37).
Theorem 2.33. Suppose $K\subset Y\subset X$. Then $K$ is compact relative to $X$ if and only if $K$ is compact relative to $Y$.
Immediately after the following is written.
By virtue of this theorem we are able, in many situation, to regard compact sets as metric spaces in their own right, without paying any attention to any embedding space. In particular, although it makes little sense to talk of open spaces, or of closed spaces (every metric space $X$ is an open subset of itself, and is a closed subset of itself), it does make sense to talk of compact metric space.
I can't understand the sentence "every metric space $X$ is an open subset of itself, and is a closed subset of itself".
Actually, $(0,1)$ is metric space for metric $d(x,y)=|x-y|$, $\forall x,y\in (0,1)$. $(0,1)$ is just open subset of itself, but is not a closed subset of itself.