Inflation has risen by more than expected due to an increase in energy bills, according to official figures.