LAGOS - Nigeria's annual inflation quickened to its highest level in five and a half years in June, official data showed on Friday, driven by rising prices of staples like bread, rice and maize and the cost of diesel, which is used to generate power.

The National Bureau of Statistics said inflation rose for the fifth straight month, hitting 18.6%, compared with 17.71% in May.

Food prices, a major headline component for Nigerian inflation, were up 20.6% year-on-year in June. Core inflation, which excludes prices of farm produce, was up 2.66 percentage points to 15.75% during the period.

"This rise in the food index was caused by increases in prices of bread and cereals, food products, potatoes, yam, and other tubers, meat, fish, oil and fat, and wine," the statistics bureau said.

Inflation, at its highest since January 2017, and the state of the economy are major issues for voters as the country heads for a national election in February, when incumbent President Muhammadu Buhari will step down.

Nigeria, Africa's largest economy, imports many key goods and services. Many importers, however, cannot access dollars from the official market due to central bank restrictions, forcing them to buy on the black market where the naira continues to weaken.

"The combined effect of power costs, exchange rate depreciation and money supply saturation is manifesting in a spiralling inflationary cycle," Financial Derivatives Company said in a note to clients.

The World Bank said in a report last month the war in Ukraine has added to Nigeria's economic strains, hiking prices of imported food and inputs for fertilizers, as well as increasing oil price volatility and uncertainty around capital flows.

The central bank in May raised the benchmark interest rate by 150 basis points to 13%, its first hike in more than two years, to combat rising inflation, sending markets tumbling.

(Reporting by MacDonald Dzirutwe; Editing by David Goodman, Philippa Fletcher and Alison Williams)