(Adds quotes from official, maintaining 2017 range)
By Gabriel Stargardter
MEXICO CITY, April 28 (Reuters) - Mexico's economy cooled slightly in the first quarter as industrial output stagnated, according to preliminary data released on Friday, but growth during the start of U.S. President Donald Trump's term was stronger than some expected.
The election of Donald Trump last year raised the specter of recession in Mexico as he threatened to shred the North American Free Trade Agreement. This sent the country's peso into a tailspin and prompted several economists to lower growth forecasts.
While those threats resurfaced this week, slow progress in starting NAFTA talks and an overall softening of rhetoric about U.S. companies that invest in Mexico have calmed the situation ahead of Trump's 100th day in office on Saturday.
"The balance of the economy in the first 100 days of the Trump administration can be summarized in the numbers published by (national statistics agency) INEGI today," Luis Madrazo, the finance ministry's chief economist, said at a news conference.
"A higher-than-expected growth rate, and a higher rate of growth compared with last year that is showing resistance to the uncertainty that has hit us from abroad."
Mexico's gross domestic product grew about 0.6 percent in the first quarter, slowing slightly from 0.7 percent in the fourth quarter, according to seasonally adjusted INEGI data.
Analysts polled by Reuters had expected a 0.5 percent growth rate for the quarter.
Compared with the year-earlier quarter, GDP grew at an annual rate of 2.7 percent, above analysts' expectations of 2.4 percent.
"First quarter GDP data from Mexico confirmed what we have long suspected – that the survey data have been overstating the weakness in the real economy," Capital Economics said in a research note. It raised its 2017 GDP forecast to 2.2 percent from 1.8 percent despite "lingering" risks to NAFTA.
Mexico's government has put 2017 growth between 1.3 and 2.3 percent, and Madrazo said the range remained unchanged for now, but would be looked at again when the final quarterly results come out on May 22.
According to INEGI's initial estimates, the industrial sector did not expand from the fourth quarter. Weak demand in the United States has weighed on Mexican factory output.
The data showed the services sector grew 1.0 percent in the first quarter from the fourth, while agriculture expanded by 0.7 percent.
The U.S. economy grew at its weakest pace in three years in the first quarter, data released on Friday showed, as consumer spending barely increased and businesses invested less in inventories. (Reporting by Mexico City Newswroom; editing by Frank Jack Daniel, Lisa Von Ahn and Diane Craft)