How does the Moderna Covid-19 vaccine work?

President Donald Trump has said a coronavirus vaccine made by Moderna has been approved for use in the US and distribution will start immediately.
It comes after a panel of US Food and Drug Administration (FDA) advisers said the benefits of the vaccine outweighed the risks for those aged 18 and up.