British factories had their strongest two months of 2017 in July and August, suggesting the Bank of England remains on track to raise interest rates soon, but the deficit in trade in goods hit an all-time high. 

The data showed Britain's economy remained in a low-growth gear in the third quarter after suffering its slowest first half to the year since 2012. 

However, the Bank of England said last month most of its policymakers thought it was likely that they would need to raise rates for the first time in a decade in the coming months. 

The bank believes last year's Brexit vote will create more inflation pressure in Britain by slowing migration to the country and dampening business investment. 

Most economists expect a first rate hike as soon as the November 2 announcement of the outcome of the Bank of England's next meeting. 

The Office for National Statistics said today that UK manufacturing output rose by a monthly 0.4% in August, matching July's pace. 

That compared with a forecast for output to rise 0.2% in a Reuters poll of economists. 

The last time growth among manufacturers was stronger was in December of last year. 

Overall industrial output - which includes the factory sector - rose by a monthly 0.2% in August, compared with 0.3% in July. 

Economists in the Reuters poll had expected growth of 0.2% in August. 

Industrial output accounts for 14% of Britain's overall economic output. 

Figures for the much bigger services sector are due to be released on October 25, along with a preliminary first estimate for third-quarter gross domestic product growth. 

Many economists say a shock weakening in those figures could cause the Bank of England to delay raising rates.

The ONS said in the three months to August manufacturing output picked up speed to grow by 0.7%, its strongest pace since February. Industrial output also gathered momentum, growing by 0.9%. 

A private-sector business survey last week suggested manufacturers saw a loss of momentum in September although price pressures grew. 

The official readings of manufacturing have tended to show a weaker picture for the sector than the surveys. 

The ONS data showed Britain's goods trade deficit with the rest of the world hit an all-time high of £14.245 billion in August, pushed up by increased imports of chemicals, machinery and textiles. 

Economists polled by Reuters had expected the deficit would narrow to £11.20 billion. 

Exports of goods rose 0.7% on the month while imports jumped 4.2%, their biggest rise since March. 

So far there has been little sign that exporters have taken advantage of the fall in the value of the pound to increase their volumes of sales abroad. 

The ONS also released figures for construction output in August which grew by 0.6% from July, its first monthly increase since May, and was up 3.5% on the year. 

The Reuters poll had pointed to no change on the month and a small annual increase of 0.2%.