Lemma 29.13.7. Let $S$ be a scheme. Let $X$ be an affine scheme. A morphism $f : X \to S$ is quasi-affine if and only if it is quasi-compact. In particular any morphism from an affine scheme to a quasi-separated scheme is quasi-affine.

Proof. Let $V \subset S$ be an affine open. Then $f^{-1}(V)$ is an open subscheme of the affine scheme $X$, hence quasi-affine if and only if it is quasi-compact. This proves the first assertion. The quasi-compactness of any $f : X \to S$ where $X$ is affine and $S$ quasi-separated follows from Schemes, Lemma 26.21.14 applied to $X \to S \to \mathop{\mathrm{Spec}}(\mathbf{Z})$. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).