Aims. Questions of how massive quiescent galaxies rapidly assembled and how abundant they are at high redshift are increasingly important in the study of galaxy formation. Looking at these systems can shed light on the processes of galaxy mass assembly and quenching of the star formation at early epochs. In order to address these questions, we aim to identify and characterize massive quiescent galaxies from z ∼ 2.5 out to the highest redshifts at which these systems can be found. The final purpose is to compare the results with the predictions of state-of-the-art semi-analytical models of galaxy formation and evolution. Methods. We defined observer-frame color–color diagrams to optimally select quiescent galaxies at z > 2.5 and applied them to the COSMOS2015 catalog. We refined the spectral energy distribution (SED) fitting analysis for the selected candidates to confirm their quiescent nature, then derived their number density, mass density, and stellar mass functions. Finally, we compared the results with previous observations and some current semi-analytic models. Results. We selected candidates for quiescent galaxies in the redshift range 2.5 ≲ z ≲ 4.5 from the COSMOS2015 catalog by means of two color–color diagrams. The additional SED fitting analysis allowed us to select 128 galaxies, consistent with being massive (log(M*/M⊙)≥10.6), old (ages ≳0.5 Gyr), and quiescent (log(sSFR [yr−1]) ≤ −10.5) objects at high redshift (2.5 < z < 4.5). Their number and mass densities are in fair agreement with previous observations and, if confirmed, show a discrepancy with current semi-analytical models of galaxy formation and evolution, that underpredict the number of massive quiescent systems up to a factor of ∼12 at 2.5 ≤ z < 3.0 and ∼10 at z ∼ 4.0. The evolution of the stellar mass functions (SMFs) of these systems is similar to previous estimates and indicates a disagreement with models, particularly with regard to the shape of the SMF. Conclusions. The present results add further evidence to the possibility that massive and quiescent galaxies can exist out to at least z ∼ 4. If future spectroscopic observations carried out with, for example, the James Webb Space Telecope (JWST), confirm the substantial presence of such a population, further work on modeling the stellar mass assembly, as well as supermassive black hole accretion and feedback processes at early cosmic epochs, is needed to understand how these systems formed, evolved, and quenched their star formation.