First you need to jump over the the Node Editor view, then select Shader Nodes and World. Also make sure Use Nodes is checked.
Then add a Noise Texture node and a Color Ramp node. Plug the Fac of the noise texture into the Color Ramp, and the Color of the Color Ramp into the Color of the default Background shader.
You can then adjust the Color Ramp and Noise Texture how you would like to create the desired starry effect.
Noise Texture Scale. This controls the size and amount of stars. Higher scale means more, smaller stars; smaller scale means less, larger stars.
Noise Texture Detail. This will adjust the shape and variation in brightness in the stars. Higher value will mean more irregularly shaped stars, but there will be a greater variation in the brightness of the stars.
Color Ramp Swatches. Adjusting the color swatches on the Color Ramp will change the size and shape of the stars. The farther apart the swatches are the bigger and more irregularly shaped the stars will be.
Shown above are the settings I used to create the below render.
I have added even a Milky Way using the Wave texture and some math!
I got a Wave texture, put through a color ramp (I have changed the direction from black to white, but it doesn't matter), and I have got a noise with a color ramp set up with less bright (through color ramp) and less big (with the scale factor of the noise), and I used the maths tool to multiply them (black parts of the noise cancel out the stars, as 1×0 is still 0), and then I just added the math output to the starfield that I have generated just like you can see in the answers above.
I think it looks pretty :)