  We introduce the space function $s(n)$ of a finitely presented semigroup $S
=<A\mid R>.$ To define $s(n)$ we consider pairs of words $w,w'$ over $A$ of
length at most $n$ equal in $S$ and use relations from $R$ for the
transformations $w=w_0\to...\to w_t= w'$; $s(n)$ bounds from above the tape
space (or computer memory) sufficient to implement all such transitions
$w\to...\to w'.$ One of the results obtained is the following criterion: A
finitely generated semigroup $S$ has decidable word problem of polynomial space
complexity if and only if $S$ is a subsemigroup of a finitely presented
semigroup $H$ with polynomial space function.
