The kuruma shrimp Marsupenaeus japonicus is an economically important crustacean. High concentrations of ammonia resulting from intensive culture and environmental pollution affect its aquaculture, but little information is available on the molecular mechanisms. We performed transcriptomic analyses of the hepatopancreas of M. japonicus subjected to ammonia stress. We obtained 44,735,330–56,680,154 clean reads from the control and treatment groups, assembled and clustered a total of 133,486 unigenes with an average of 1178 bp and N50 of 18,769 bp. Comparative transcriptome analyses identified 2294 differentially expressed genes, a large number of which were related to immune function, oxidative stress, apoptosis, molting, and the membrane. In addition, totals of 36 gene ontology terms and 177 Kyoto Encyclopedia of Genes and Genomes pathways were identified. In addition, the genes encoding heat shock protein 90 (HSP90), HSP10, glutamine synthase (involved in the nitrogen pathway), and antioxidant enzymes (catalase and glutathione S-transferase) were significantly upregulated by ammonia stress. Therefore, ammonia probably impaired the immune response, induced oxidative stress, disrupted membranes, and induced apoptosis in M. japonicus. To maintain physiological homeostasis, M. japonicus responded to ammonia stress by upregulating heat shock proteins and antioxidant enzymes, and enhancing the nitrogen metabolism pathway. In conclusion, this is the first comprehensive investigation on the transcriptomic response to ammonia stress in M. japonicus, and the results clarify the response of shrimp to ammonia toxicity. The genes and pathways identified here provide valuable information on the molecular mechanism of the tolerance of shrimp to ammonia stress and will facilitate the molecular-assisted breeding of varieties of M. japonicus with enhanced tolerance to ammonia.