The problem of nonparametric regression function estimation is considered using the complete orthonormal system of trigonometric functions or Legendre polynomials e k , k = 0, 1,. .. , for the observation model y i = f (x i) + η i , i = 1,. .. , n, where the η i are independent random variables with zero mean value and finite variance, and the observation points x i ∈ [a, b], i = 1,. .. , n, form a random sample from a distribution with density ̺ ∈ L 1 [a, b]. Sufficient and necessary conditions are obtained for consistency in the sense of the errors f − f N , |f (x) − f N (x)|, x ∈ [a, b], and E f − f N 2 of the projection estimator f N (x) = N k=0 c k e k (x) for c 0 , c 1 ,. .. , c N determined by the least squares method and f ∈ L 2 [a, b].