A new method for space-group determination is described. It is based on a symmetry analysis of the structure-factor phases resulting from a structure solution in space group P1. The output of the symmetry analysis is a list of all symmetry operations compatible with the lattice. Each symmetry operation is assigned a symmetry agreement factor that is used to select the symmetry operations that are the elements of the space group of the structure. On the basis of the list of the selected operations the complete space group of the structure is constructed. The method is independent of the number of dimensions, and can also be used in solution of aperiodic structures. A number of cases are described where this method is particularly advantageous compared with the traditional symmetry analysis.