Aims. We determined the K s band luminosity function (LF), and inferred the corresponding stellar mass function, of cluster galaxies at redshift z 1.2, using near-infrared images of three X-ray luminous clusters at z = 1.11, 1.24, 1.27. Methods. The composite LF was derived down to M * + 4, by means of statistical background subtraction, and is well described by a Schechter function with K * s = 20.5
+0.4−1 and α = −1.0 +0.2 −0.3 . Using available X-ray mass profiles we determined the M/L ratios of these three clusters, which tend to be lower than those measured in the local universe. Finally, from the K s band composite LF we derived the stellar mass function of cluster galaxies. Results. With these data, no significant difference can be seen between the cluster galaxies LF and the LF of field galaxies at similar redshift. We also found no significant evolution out to z 1.2 in the bright ( 2. Conclusions. The results obtained in this work support and extend previous findings that most of the stars in bright galaxies were formed at high redshift, and that K s -bright (M > 10 11 M ) galaxies were already in place at z 1.2, at least in the central regions of X-ray luminous clusters. Together with recent results on the field galaxy stellar mass function, this implies that most of the stellar mass is already assembled in massive galaxies by z 1, both in low and high density environments.