The stars are at enormous distances from us, yet we can see thousands in the sky without the aid of a telescope. This tells us that the stars are extremely luminous. We must then ask what the source of their enormous energy could be.
Given what we know about stars like the Sun, there are two possible sources of such energy: (1) gravitational contraction and (2) thermonuclear reactions that convert mass to energy. Both play important roles in producing energy over the lifetime of a star, but the primary energy source for the long stable period of a star's life is thermonuclear fusion.