A small open reading frame (smORF) or short open reading frame (sORF) encodes a polypeptide of <100 amino acids in eukaryotes (50 amino acids in prokaryotes). Studies have shown that several sORF-encoded peptides (SEPs) have important physiological functions in different organisms. Many ribosomal proteins belonging to SEPs play important roles in several cellular processes, such as DNA damage repair and apoptosis. Several studies have implicated SEPs in response to infection and innate immunity, but the mechanisms have been unclear for most of them. In this study, we identified a sORF-encoded ribosomal protein S27 (RPS27) in Marsupenaeus japonicus. The expression of MjRPS27 was significantly upregulated in shrimp infected with white spot syndrome virus (WSSV). After knockdown of MjRPS27 by RNA interference, WSSV replication increased significantly. Conversely, after MjRPS27 overexpression, WSSV replication decreased in shrimp and the survival rate of the shrimp increased significantly. These results suggested that MjRPS27 inhibited viral replication. Further study showed that, after MjRPS27 knockdown, the mRNA expression level of MjDorsal, MjRelish, and antimicrobial peptides (AMPs) decreased, and the nuclear translocation of MjDorsal and MjRelish into the nucleus also decreased. These findings indicated that MjRPS27 might activate the NF-κB pathway and regulate the expression of AMPs in shrimp after WSSV challenge, thereby inhibiting viral replication. We also found that MjRPS27 interacted with WSSV's envelope proteins, including VP19, VP24, and VP28, suggesting that MjRPS27 may inhibit WSSV proliferation by preventing virion assembly in shrimp. This study was the first to elucidate the function of the ribosomal protein MjRPS27 in the antiviral immunity of shrimp.