TITLE: Does pullback of schemes by monomorphism produce topological pullback?
QUESTION [7 upvotes]: Suppose I have scheme maps $X\to Z,Y\to Z$. It is not in general true that the fibre product $X\times_{Z}Y$ has the same underlying topological space (or even the same underlying set) as the fiber product of topological spaces, e.g. taking both maps to be $Spec(\mathbb{C})\to Spec(\mathbb{R})$.
However, I believe it is not hard to show (basically one computes the fibre product affine-locally) that the underlying space of $X\times_{Z}Y$ IS homeomorphic to the topological pullback if $X\to Z$ is any of the following:

an open embedding
a closed embedding
induced by localization (i.e. $Spec(S^{-1}A)\to Spec(A)$.)

In particular, if one composes these things in the correct order, I believe this gives a one-line proof that the scheme-theoretic fibre over a point agrees with the topological fibre.
These also happen to be the canonical examples of monomorphisms (along with compositions of these) in the category of schemes that I know of. So my question is: 

If $X\to Z$ is a monomorphism, is the underlying space of
  $X\times_{Z}Y$ homeomorphic to the pullback in the category of
  topological spaces?

REPLY [5 votes]: Yes.
By the the explicit construction of the fiber product of locally ringed spaces (in particular, of schemes), it follows that  the continuous map $|X \times_Z Y|\to |X| \times_{|Z|} |Y|$ is surjective and that the fiber over some point $(x,y,z)$  in $|X| \times_{|Z|} |Y|$ is $\mathrm{Spec}(\kappa(x) \otimes_{\kappa(z)} \kappa(y))$. A basis of the topology on $|X \times_Z Y|$ is given by the open subsets
$$\Omega(U,V,T,f) = \{(x,y,z,\mathfrak{p}) : x \in U, y \in V, z \in T, f(x,y,z) \notin \mathfrak{p}\}$$
where $U \subseteq X$, $V \subseteq Y$, $T \subseteq Z$ are open subsets such that $U$ and $V$ map into $T$, $f \in \mathcal{O}_X(U) \otimes_{\mathcal{O}_Z(T)} \mathcal{O}_Y(V)$, and $f(x,y,z)$ denotes the image of $f$ in $\kappa(x) \otimes_{\kappa(z)} \kappa(y)$.
A reference for the theory of monomorphisms of schemes resp. epimorphisms of commutative rings is

Séminaire Samuel. Algèbre commutative, 2, 1967-1968, Les épimorphismes d'anneaux, available at nundam.

By Prop. 1.5 in Lazard's Exp. No. 4 a monomorphism $X \to Z$ is injective on the underlying sets and induces isomorphisms on residue fields. Therefore, $\mathrm{Spec}(\kappa(x) \otimes_{\kappa(z)} \kappa(y)) = \mathrm{Spec}(\kappa(y))$ is a single point. It follows that the continuous map $|X \times_Z Y|\to |X| \times_{|Z|} |Y|$ is bijective. The image of a basic-open subset $\Omega(U,V,T,f)$ is
$$\{(x,y,z) \in |U| \times_{|T|} |V| : f(x,y,z) \neq 0\}.$$
It is open: If $f(x,y,z) \neq 0$, then $f_{x,y,z} \in \mathcal{O}_{X,x} \otimes_{\mathcal{O}_{Z,z}} \mathcal{O}_{Y,y}$ is invertible. Since directed colimits commute with tensor products, we infer that there are open neighborhoods $U',V',T'$ of $x,y,z$ inside $U,V,T$ such that a) the inverse $f^{-1}$ of $f$ is defined in $\mathcal{O}_X(U') \otimes_{\mathcal{O}_Z(T')} \mathcal{O}_Y(V')$, and b) the equation $f f^{-1} = 1$ already holds in this tensor product. It follows that $U' \times_{V'} T'$ is contained in the set, and this is open with respect to the fiber product topology.