MEXICO CITY—The Mexican economy contracted in the first quarter from the end of last year, a challenge for the six-month-old government of President Andrés Manuel López Obrador, who is aiming for growth to average 4% during his six-year term.

Gross domestic product, a measure of output in goods and services, fell 0.2% in seasonally adjusted terms from the fourth quarter of 2018, the National Statistics Institute said Friday. The result was unchanged from the institute’s preliminary reading at the end of April.

Industrial...