We aimed to examine the association between the quantity and quality of dietary fat in early pregnancy and gestational diabetes mellitus (GDM) risk. In total, 1477 singleton pregnant women were included from Sichuan Provincial Hospital for Women and Children, Southwest China. Dietary information was collected by a 3-d 24-h dietary recall. GDM was diagnosed based on the results of a 75-g, 2-h oral glucose tolerance test at 24–28 gestational weeks. Log-binomial models were used to estimate relative risks (RR) and 95% CI. The results showed that total fat intake was positively associated with GDM risk (Q4 v. Q1: RR = 1·40; 95 % CI 1·11, 1·76; Ptrend = 0·001). This association was also observed for the intakes of animal fat and vegetable fat. After stratified by total fat intake (< 30 %E v. ≥ 30 %E), the higher animal fat intake was associated with higher GDM risk in the high-fat group, but the moderate animal fat intake was associated with reduced risk of GDM (T2 v. T1: RR = 0·65; 95 % CI 0·45, 0·96) in the normal-fat group. Vegetable fat intake was positively associated with GDM risk in the high-fat group but not in the normal-fat group. No association between fatty acids intakes and GDM risk was found. In conclusion, total fat, animal and vegetable fat intakes were positively associated with GDM risk, respectively. Whereas when total fat intake was not excessive, higher intakes of animal and vegetable fat were likely irrelevant with increased GDM risk, even the moderate animal fat intake could be linked to lower GDM risk.