The National Bureau of Statistics (NBS) said inflation rose for the sixth straight month, hitting 19.64% from 18.60% year on year in June.
NBS data showed the July inflation reading was the highest since at least the start of 2009.
Refinitiv data showed it was the highest since the 24.32% recorded in September 2005.
Food prices were up 22.02% year on year in July, caused by increases in prices of bread and cereals, potatoes, yam, meat, fish, oil and other items.
Core inflation, which excludes prices of farm produce, was up 16.26% from the same period last year, with gas, liquid and solid fuel, transportation by road and air, garments and hire of clothing among contributing factors.
Rising inflation and the state of the economy are major issues as the country heads for a national election in February, when voters will choose a new president as incumbent Muhammadu Buhari steps down.
The naira currency has been weakening on the parallel market due to a scarcity of foreign currency since July 2021, when the central bank stopped forex sales to retail currency traders to ease pressure on reserves and support the official market.
The move funnelled demand towards the unofficial market, where the currency is freely traded.
Policymakers argue persistent inflationary pressures are structural and largely related to imports.
Analysts at Capital Economics said in a research note that Nigeria’s inflation was probably not far from its peak but would remain elevated.
They predicted another interest rate increase at the central bank’s next policy meeting in September.
Reporting by Chijioke Ohuocha, Editing by Alexander Winning and Ed Osmond