It is clear that the standard definition is local on $Y$, so by taking an affine open cover, it suffices to prove the case where $Y$ is affine, say $Y\cong \operatorname{Spec}(A)$.
We thus have a morphism $\pi: X \rightarrow \operatorname{Spec}(A)$, determined by a ring map $\pi^{\sharp}(A): A \rightarrow \Gamma(X,\mathcal{O}_X)$. Let $I$ be the kernel of the map, so that $\pi$ factors as $\psi \circ \varphi :X\rightarrow\operatorname{Spec}(A/I)\rightarrow\operatorname{Spec}(A)$, where $\psi$ is the standard closed immersion, and $\varphi^{\sharp}$ induces an isomorphism of global sections. We will show that $\varphi$ is an isomorphism.
Since $\pi$ and $\psi$ are both closed immersions in the usual sense, we have e.g. that $\pi_*(\mathcal{O}_X)_{\varphi(p)} \cong \mathcal{O}_{X,p}$ and $\pi_*(\mathcal{O}_X)_q \cong 0$ if $q \not\in \operatorname{Im}(\pi)$. From this observation it follows that $\pi_p:A_{\pi(p)}\rightarrow \mathcal{O}_{X,p}$ is surjective, and so too is $\varphi_{p}:(A/I)_{\varphi(p)}\rightarrow \mathcal{O}_{X,p}$. Provided $\varphi_p$ is also injective, it is an isomorphism, which tells us in particular that $\operatorname{Im}(\varphi) = \operatorname{Spec}(A/I)$, hence $\varphi$ is also a homeormorphism of topological spaces*, and so an isomorphism of schemes.
To prove injectivity, let $\mathcal{I} = \ker(\psi^{\sharp})$ and $\mathcal{J}=\ker(\pi^{\sharp})$. Clearly $\mathcal{I}\subset \mathcal{J}$ and on the distinguished affine open subset $D(f)$, $\mathcal{I}(D(f))= I_f$. $\mathcal{J}(D(f))$ is the kernel of the map $\pi^{\sharp}:A_f\rightarrow \Gamma(\pi^{-1}(D(f)),\mathcal{O}_X)$, and moreover $\pi^{-1}(D(f)) = X_{\pi^{\sharp}(f)}$. They key step now is to notice that $X$ is quasi-compact and quasi-seperated (qcqs), since it is homeomorphic to a closed subset of an affine scheme, and affine schemes are qcqs. The qcqs lemma ($7.3.5$) tells us that there is a natural isomorphism $\Gamma(X,\mathcal{O}_X)_{\pi^{\sharp}(f)} \cong \Gamma(X_{\pi^{\sharp}(f)},\mathcal{O}_X)$. The naturality gives that the ring map $A_f\rightarrow \Gamma(X_{\pi^{\sharp}(f)},\mathcal{O}_X)$ is the localisation of the map $\pi^{\sharp}(A)$, so it's kernel is $\mathcal{J}(\operatorname{Spec}(A))_f = I_f = \mathcal{I}_f$. Thus the two sheaves agree on a base of open sets, and so are equal, hence $\varphi$ is an isomorphism as discussed earlier.
*We knew already that $\varphi$ was a homeomorphism with a closed subset and that $\operatorname{Supp}(\varphi_*(\mathcal{O}_X))=\operatorname{Im}(\varphi)$. But if $\varphi_*(\mathcal{O}_X)\cong \mathcal{O}_{A/I}$, then the sheaves have the same support, namely the whole scheme.