mRNA vaccines work by introducing a small piece of mRNA that encodes a viral protein, such as the spike protein in the case of SARS-CoV-2. Once inside the body, the mRNA is taken up by cells, which then use the instructions to produce the viral protein. The immune system recognizes this protein as foreign, generating an immune response that prepares the body to fight the actual virus if encountered in the future.