The drop was bigger than expected, with markets pricing in a fall to 5.1%. Meanwhile RPI fell to 5.4%, from 5.6% in September.
The ONS said the largest downward pressures came from falls in the cost of food (due to significant and widespread discounting by supermarkets and good harvests for certain produce), air fares and petrol.
Partially offsetting these falls were upward pressures from increases in the cost of clothing, electricity and gas.
Last month the CPI index hit a record high of 5.2%, equalling the previous high set in September 2008. The Bank of England’s target rate for CPI is 2%.
Rates set by the October inflation figures include allowances and indexation for income tax, national insurance, inheritance tax, capital gains tax, disability and maternity benefits, income support and tax credits.
The increase has put further pressure on the Chancellor, who is battling to reduce the budget deficit, but will provide much-needed relief to claimants struggling to cope with the rising prices of food and fuel.
The Bank of England had already said inflation will hit 5% this year as a result of higher utility bills, but expects price rises to slow in 2012 and 2013.