A preliminary estimate published by the national statistics agency showed that Mexico's economy, Latin America's second biggest, expanded by 0.1% in the April-June period from the previous quarter, when adjusted for seasonal swings.

A Reuters poll of economists had forecast GDP would be flat compared with the first quarter, when the economy shrank by 0.2% quarter-on-quarter. The statistics office is due to publish final data for the second quarter on Aug. 23.

During the first half of 2019, the economy grew 0.3 percent in adjusted terms from the same period a year earlier.

William Jackson, an economist at Capital Economics, said the data painted the picture of a struggling economy, arguing it could encourage Mexico's central bank to lower interest rates.

"The key point is that this is still really, really weak," he said. "We had already been penciling in a rate cut. Given the weakness of the economy and the way inflation is coming down, there is a reasonable chance of a (rate) cut in August."

Economists generally define two consecutive quarters of negative GDP as a technical recession, though there is no established global definition for the phenomenon.

A breakdown of the Mexican GDP data showed that primary activities, including agriculture, declined by 3.4% during the second quarter from the previous quarter, while secondary activities, such as manufacturing, were flat.

The meager growth was fueled by a 0.2% rise in tertiary activities, which include retail and services.

The government has rejected the suggestion the economy is in a slump, and President Andres Manuel Lopez Obrador hailed the GDP figures during his morning news conference, calling them "very good news" and casting them as a rebuke to his critics.

Mindful of the sluggish economy, the Mexican finance ministry this week unveiled a $25 billion stimulus package aimed at ramping up growth.

Investor confidence in Mexico has been shaken by some of the decisions of Lopez Obrador, a leftist exponent of economic nationalism who took office in December vowing to reduce chronic inequality and deliver average annual growth of 4%.

In particular, his decision to cancel a partly built $13 billion new Mexico City airport and his retreat from the prior government's opening of the oil and gas industry to private capital have raised doubts about his economic credentials.

During the past few months, private and public sector analysts have pared back their Mexican growth forecasts, with some now predicting little expansion at all in 2019. Lopez Obrador has said he expects growth of 2% this year.

The president has attacked critics of his policies as supporters of what he has characterized as a corrupt "neo-liberal" era that preceded his time in office.

However, he has also had to contend with the risk of economic disruption from the United States - the destination for around 80% of Mexico's goods exports - because of tensions with U.S. President Donald Trump over illegal immigration.

In adjusted terms, the economy grew by 0.4% in the second quarter in comparison to the same period a year earlier. In unadjusted terms, it shrank by 0.7%, the figures showed.

(Reporting by Dave Graham; Editing by Cynthia Osterman and Steve Orlofsky)

By Dave Graham and Anthony Esposito