The most common approach for approximating non-periodic function defined on a finite interval is based on considering polynomials as basis functions. In this paper we will address the non-optimallity of polynomial approximation and suggest to switch from powers of $$x$$ x to powers of $$\sin (px)$$ sin ( p x ) where $$p$$ p is a parameter which depends on the dimension of the approximating subspace. The new set does not suffer from the drawbacks of polynomial approximation and by using them one can approximate analytic functions with spectral accuracy. An important application of the new basis functions is related to numerical integration. A quadrature based on these functions results in higher accuracy compared to Legendre quadrature.