Let us associate to any commutative ring A its spectrum, that is the topological space Spec A. As a set, Spec A consists of all the prime ideals in A. For each subset S A we define as closed sets in Spec A:

V(S) := {p ∈ Spec A | S ⊂ p} ⊂ Spec A

If X is an affine variety, defined over an algebraically closed field, and O(X) is its coordinate ring, we have that the points of the topological space underlying X are in one-to-one correspondence with the maximal ideals in O(X).

We also define the basic open sets in Spec A as

U_{ƒ} := Spec A \ V(ƒ) = Spec A_{ƒ} with ƒ ∈ A,

where A_{ƒ} = A[ƒ^{-1}] is the localization of A obtained by inverting the element ƒ. The collection of the basic open sets U_{ƒ}, ∀ ƒ ∈ A forms a base for Zariski topology. Next, we define the structure sheaf O_{A} on the topological space Spec A. In order to do this, it is enough to give an assignment

U ↦ O_{A}(U) for each basic open set U = U_{ƒ} in Spec A.

The assignment

U_{ƒ }↦ A_{ƒ}

defines a B-sheaf on the topological space Spec A and it extends uniquely to a sheaf of commutative rings on Spec A, called the structure sheaf and denoted by O_{A}. Moreover, the stalk at a point p ∈ Spec A, O_{A,p} is the localization A_{p} of the ring at the prime p. While the differentiable manifolds are locally modeled, as ringed spaces, by (R^{n}, C^{∞}_{Rn}), the schemes are geometric objects modeled by the spectrum of commutative rings.

Affine scheme is a locally ringed space isomorphic to Spec A for some commutative ring A. We say that X is a scheme if X = (|X|, O_{X}) is a locally ringed space, which is locally isomorphic to affine schemes. In other words, for each x ∈ |X|, ∃ an open set U_{x} ⊂ |X| such that (U_{x}, O_{X|Ux}) is an affine scheme. A morphism of schemes is just a morphism of locally ringed spaces.

There is an equivalence of categories between the category of affine schemes (aschemes) and the category of commutative rings (rings). This equivalence is defined on the objects by

(rings)^{op} → (aschemes), A_{ }↦ Spec A

In particular a morphism of commutative rings A → B contravariantly to a morphism Spec B → Spec A of the corresponding affine superschemes.

Since any affine variety X is completely described by the knowledge of its coordinate ring O(X), we can associate uniquely to an affine variety X, the affine scheme Spec O(X). A morphism between algebraic varieties determines uniquely a morphism between the corresponding schemes. In the language of categories, we say we have a fully faithful functor from the category of algebraic varieties to the category of schemes.