Let R be a commutative ring with Z(R) its set of zero-divisors. In this paper, we study the total graph of R, denoted by T(Gamma(R)). It is the (undirected) graph with all elements of R as vertices and, for distinct x, y is an element of R, the vertices x and y are adjacent if and only if x + y is an element of Z(R). We investigate properties of the total graph of R and determine all isomorphism classes of finite commutative rings whose total graph has genus at most one (i.e., a planar or toroidal graph). In addition, it is shown that, given a positive integer g, there are only finitely many finite rings whose total graph has genus g.