To assess the immune response of hemocytes to white spot syndrome virus (WSSV) or Vibrio alginolyticus infection in the mud crab Scylla paramamosain, a transcriptome analysis was performed. We report the analysis of 45131 transcripts from S. paramamosain hemocytes by de novo assembly. A comparison with GenBank protein and nucleotide sequences identified 33699 genes as previously known. The length distribution of the genes was 8147 genes ≥200 bp, 4714 genes ≥300 bp, and 3517 genes ≥2000 bp. A total of 21579 simple sequence repeats (SSRs) were found in the transcriptomic dataset, including 9% monomers, 53.34% dimers and 32.55% trimers. A total of 13172 and 5087 differentially expressed transcripts were found in the V. alginolyticus-infected group and WSSV-infected group, respectively. Of these, 5920 transcripts were up-regulated and 7252 were down-regulated in the V. alginolyticus-infected crabs and 2302 transcripts were up-regulated and 2785 were down-regulated in the WSSV-infected crabs. Additionally, 3096 transcripts were differentially expressed simultaneously in the V. alginolyticus-infected crabs and the WSSV-infected crabs. Several known immune-related genes such as heat shock protein, Janus kinase, STAT, relish, caspase, Ca2+-transporting ATPase and lysosomal alpha-mannosidase were found among the differentially expressed transcripts. Transcription and its regulation were significant biological processes, and ATP binding and zinc ion binding were significant molecular functions. This is the first report of comparative transcriptomic analysis of crab hemocytes in response to WSSV or V. alginolyticus infection. These findings will contribute to our understanding of the immune response to WSSV and V. alginolyticus infection in crustaceans.