Inflation has accelerated to its fastest pace in three years as surging fuel prices and electricity bills add to cost pressures in the economy.