TITLE: What morphisms of schemes fulfill this property?
QUESTION [5 upvotes]: Let $f:Y\to X$ and $g:Z\to Y$ be morphisms of schemes and take the product $Z\times_X Y$ with respect to the composition $g\circ f:Z\to X$ and $f$.
What property of a scheme morphism does $f$ have to fulfill such that the projection $Z\times_X Y\to Z$ is an isomorphism of schemes?
I think ''open immersion'' is a possibility. Are there other?

REPLY [9 votes]: It is enough to assume  that $f$ be a monomorphism : this is a purely categorical result which has nothing to do with schemes.
If that is the case, the projection $p:Z\times_X Y\to Z$ has as inverse the morphism $$s=(id_Z,g):Z\to Z\times_X Y$$  
Yes, but what are the monomorphisms in the category of schemes?
As usual the Master has the answer( in EGA $IV_4$, 17.2.6 ) :
A morphism  $f : Y \to X$  locally of finite type  is a monomorphism if and only if 
for every $x \in X$, the fiber $f^{-1}(x)$ is either empty or isomorphic to $Spec (\kappa(x))$. 
So a monomorphism is injective but the converse is completely false: given a non trivial extension of fields $k\subsetneq K$, the corresponding (trivially bijective!)  morphism of schemes $Spec(K)\to Spec(k)$ is never a monomorphism. 
However to finish on an optimistic note, let me remark that closed or open immersions ( you were right  about those) are monomorphisms.