Brexit was cited as the main reason for the contraction following stockpiling in preparations for the original March departure date.
ONS head of GDP, Rob Kent-Smith, said: “GDP contracted in the second quarter for the first time since 2012 after robust growth in the first quarter.
“Manufacturing output fell back after a strong start to the year, with production brought forward ahead of the UK’s original departure date from the EU.
“The construction sector also weakened after a buoyant beginning to the year, while the often-dominant service sector delivered virtually no growth at all.
“The trade deficit narrowed markedly, as imports fell following a sharp rise in the first quarter ahead of the UK’s original departure date from the EU.”
New building work static
The ONS also revealed a slump in the private sector new house building, but this was counter-balanced by an increase in public sector house building.
Overall, new construction work decreased by 1.3 per cent in the three months of April to June compared with the previous quarter, largely reversing the previous increase of 1.4 per cent in January to March.
The figures showed that private new housing work fell by £177m in the quarter while public new housing work saw significant growth rising £224m.