Fibroblast growth factor 21 (FGF21) is an endocrine hormone that exhibits anti-diabetic and anti-obesity activity. FGF21 expression is increased in patients with and mouse models of obesity or nonalcoholic fatty liver disease (NAFLD). However, the functional role and molecular mechanism of FGF21 induction in obesity or NAFLD are not clear. As endoplasmic reticulum (ER) stress is triggered in obesity and NAFLD, we investigated whether ER stress affects FGF21 expression or whether FGF21 induction acts as a mechanism of the unfolded protein response (UPR) adaptation to ER stress induced by chemical stressors or obesity. Hepatocytes or mouse embryonic fibroblasts deficient in UPR signalling pathways and liver-specific eIF2α mutant mice were employed to investigate the in vitro and in vivo effects of ER stress on FGF21 expression, respectively. The in vivo importance of FGF21 induction by ER stress and obesity was determined using inducible Fgf21-transgenic mice and Fgf21-null mice with or without leptin deficiency. We found that ER stressors induced FGF21 expression, which was dependent on a PKR-like ER kinase–eukaryotic translation factor 2α–activating transcription factor 4 pathway both in vitro and in vivo. Fgf21-null mice exhibited increased expression of ER stress marker genes and augmented hepatic lipid accumulation after tunicamycin treatment. However, these changes were attenuated in inducible Fgf21-transgenic mice. We also observed that Fgf21-null mice with leptin deficiency displayed increased hepatic ER stress response and liver injury, accompanied by deteriorated metabolic variables. Our results suggest that FGF21 plays an important role in the adaptive response to ER stress- or obesity-induced hepatic metabolic stress.