By Michael Nienaber and Sarah White

BERLIN/MADRID (Reuters) - German annual inflation hit a five-month high in June while Spanish consumer prices fell slightly less than expected, in encouraging signs for the European Central Bank as it frets over persistently low inflation across the euro zone.

Economists have warned that Britain's decision to leave the European Union could further dampen growth and inflation across the euro zone, raising expectations that the ECB may beef up its monetary stimulus.

But the German and Spanish inflation data suggested that the bloc-wide rate could rise more strongly than expected and creep into positive territory, Helaba economist Ulrich Wortberg said.

Economists polled by Reuters so far expect the inflation rate for the euro zone, due out on Thursday, to show a zero reading for June after a decline of 0.1 percent in May.

The bloc has struggled with little or no inflation for the past year, caused mainly by a plunge in oil prices.

The ECB has been buying government and corporate debt and also cut interest rates to record lows in an attempt to push inflation up to its target of around 2 percent.

German consumer prices, harmonized to compare with other European countries (HICP), rose by 0.2 percent on the year after being unchanged in May, the Federal Statistics Office said.

The reading, in line with a Reuters consensus forecast, was the highest since January, when inflation stood at 0.4 percent.

A breakdown of non-harmonized inflation data showed that energy prices remained the main drag on the headline figure, but they fell less sharply than in the previous month. Costs for food and services increased faster than in May.

"German headline inflation should continue to rise as the drag from the energy component eases," Capital Economics analyst Jennifer McKeown said. But she added that consumer prices were unlikely to surge.

"The pace of wage growth is still fairly subdued and will be contained by the very low level of consumers’ inflation expectations, immigration and uncertainty about the effects of Brexit," she said.

The German headline inflation rate is therefore unlikely to reach 2 percent over the next couple of years, McKeown said. She said the ECB should increase its monetary policy support.

The German data came after Spain's National Statistics Institute said Spanish consumer prices fell slightly less than expected in June, dropping 0.9 percent year on year against a forecast of 1.0 percent.

In Spain, which depends heavily on energy imports, EU-harmonized consumer prices have been deep in negative territory for almost a year and have not topped 2 percent in around 3 years, weighed down by low global oil prices.

(Reporting by Michael Nienaber in Berlin, Sarah White and Paul Day in Madrid; Writing by Michael Nienaber; Editing by Hugh Lawson)