In this paper we address the important issue of establishing a formal background for the management of semistructured data. We define a data model and propose an algebra for XML. The algebra, clearly inspired by relational algebra, is quite intuitive; nevertheless it is able to represent most of XQuery expressions.