Summary: The $n$-queens problem is a classical combinatorial problem in which it is required to place $n$ queens on an $n\times n$ chessboard so that no two can attack, that is so that no two of them are in the same row, column, or diagonal. In this work we give a new algorithm for solving this problem which is up to four times faster than the usual algorithm.