The U.K. economy grew at its fastest pace in six months in July, an unexpectedly strong performance that will allay fears Britain is facing a possible pre-Brexit recession.

The economy recorded growth across the board, with the dominant services sector enjoying its best month this year. All else being equal, it will expand 0.4% in the third quarter even if output is unchanged in August and September, avoiding a second straight quarter of contraction.

However, there is evidence that the economy lost some momentum more recently as the political crisis over Brexit hit confidence and the trade war between the U.S. and China escalated.

In a report on Monday, KPMG warned that leaving the European Union without a deal could trigger a recession lasting four quarters, with output contracting by 1.5% next year. The Resolution Foundation said the next recession could be “unnecessarily painful” because monetary and fiscal policy are ill-equipped to combat it.