The statistics office said growth from April through June declined 0.2 percent, continuing a steady decline that followed growth to start the year.
Economists said the decline was worse than expected, but not a huge surprise.
The pound fell sharply after the data was released.
The U.K. economy contracted by 0.2% in the most recent quarter, feeding fears of a recession as the country approaches a deadline to exit from the European Union. It marks the first quarterly contraction in economic activity since 2012.
Why is the economy shrinking?
June manufacturing data was also unexpectedly poor and output for the quarter contracted at the fastest rate since early 2009, when Britain was mired in recession.
The decline was partly attributed to a decline in vehicle production (as summer shutdowns for planned maintenance were brought forward to April in anticipation of a March Brexit date) and a slowdown in stockpiling. The ONS attributed the decline partly to lower auto production as annual summer shutdowns for planned maintenance were brought forward to April in anticipation of the last Brexit deadline.
"The construction sector also weakened after a buoyant beginning to the year, while the often-dominant service sector delivered virtually no growth at all".More news: Liam Hemsworth finally breaks his silence over split with Miley Cyrus
Listing the Brexit-related effects, the national statistics office cited problems such as the stockpiling of goods in the first quarter, along with shutdowns by carmakers.
This figure though is set to be the worst in the G7.
Production output fell by 1.4%, with manufacturing showing a 2.3% decline.
What is the chancellor saying?
Speaking to the BBC, Javid said: "I am not expecting a recession at all".
"And in fact, don't take my word for it". Experts expected growth to be flat. Friday's figures also showed that British consumers remain upbeat as wages are rising solidly. "We expect this trend to continue for the rest of the year".
The data comes at a time when there are signs other economies are slowing. Industrial output fell in Germany on Wednesday, while Italy's debt has increased massively.
Mr Javid said the reason for "volatility" was uncertainty about Brexit, which could be resolved by leaving the European Union on October 31.More news: Perisic poised to join Bayern, reveals Kovac
While most economists expect a rebound in the third quarter of the year as auto factories return to work and a combination of low unemployment and rising wages keeps consumer spending bubbling up, the countdown to Brexit and a possible "no-deal" on October 31 means that the outlook both for the United Kingdom and Ireland still hangs in the balance.
The employers' body, the CBI, said the contraction was "concerning".
"Nonetheless, it's clear from our business surveys that underlying momentum remains lukewarm, choked by a combination of slower global growth and Brexit uncertainty".
"As a result, business sentiment is dire".
The Federation of Small Businesses has issued a plea to the chancellor for an emergency budget.
"Time is of the essence. So we could face a very, very hard dilemma".
Tombs highlighted stockpiling as a major factor in the economic contraction, saying the economy is "sluggish" but emphasising that it has "not stalled".
Government spending increased by 0.7%.More news: Nike Just Launched A Sneaker Club For Your Kids' Growing Feet