Definition of tensor product of rings Let $X=\operatorname{Spec} A,Y=\operatorname{Spec}B$ and $Z=\operatorname{Spec}C$ be affine schemes, with $A,B,C$ commutative rings. According to Wikipedia, the following holds:
$X \times_Y Z\cong \operatorname{Spec}\left( A\otimes_B C \right)$.

Question: What is the tensor products of rings? Do we view $A$ and $C$ as $B$-algebras in some kind of way?
 A: $A\otimes_B C$ does have a structure of $B-$algebra. The ring structure on $A\otimes_B C$ is defined by $(a\otimes c)\cdot(a'\otimes c')=(aa'\otimes cc').$ This has the structure of a $B-$algebra by
$$ b(a\otimes c)=(ba\otimes c)=(a\otimes bc)$$
where we used the definition of the tensor product.
In particular, there is a structure map $\operatorname{Spec}(A\otimes_B C)\to \operatorname{Spec}(B)$ fitting into the diagram
$\require{AMScd}$
\begin{CD}
\operatorname{Spec}(A\otimes_B C) @>{}>> \operatorname{Spec}(C)\\
@VVV @VVV\\
\operatorname{Spec}(A) @>{}>> \operatorname{Spec}(B).
\end{CD}
Edit: Following the request below, I will just add the following comment: you should notice that the morphism $\operatorname{Spec}(A)\to \operatorname{Spec}(B)$ corresponds to a morphism of rings $f:B\to A$ (using the antiequivalence of categories between commutative unital rings and affine schemes), so that $A$ has the structure of a $B-$algebra. This lets us define $b\cdot a$ for $a\in A$ by $f(b)a=b\cdot a$. The same thing applies for $\operatorname{Spec}(C)\to \operatorname{Spec}(B)$ so that $C$ has a $B-$algebra structure.
