The article describes a complete numerical solution of a recently formulated benchmark problem devoted to the parametric study of Rayleigh-Bénard instability in rectangular two-and three-dimensional boxes. The solution is carried out by the spectral Galerkin method with globally defined, three-dimensional, divergent-free basis functions, which satisfy all boundary conditions. The general description of these three-dimensional basis functions, which can be used for a rather wide spectrum of problems, is presented. The results of the parametric calculations are presented as neutral curves showing the dependence of the critical Rayleigh number on the aspect ratio of the cavity. The neutral curves consist of several continuous branches, which belong to different modes of the most dangerous perturbation. The patterns of different perturbations are also reported. The results obtained lead to some new conclusions about the patterns of the most dangerous perturbations and about the similarities between two-and three-dimensional models. Some extensions of the considered benchmark problem are discussed.