Consumer prices rose a brisk 0.3 percent in October, which was in line with expectations and driven by the sharpest rise in energy costs in five months, the government reported on Thursday.

The Consumer Price Index, the most broadly used gauge of inflation, rose at the same rate as in September, which was the steepest rise since a 0.7 jump in May, according to the Labor Department report.

But core prices, which strip out volatile energy and food costs, rose a more modest 0.2 percent in October, also in line with expectations.

Consumer prices were 3.5 percent higher than a year ago, the biggest 12-month increase since August 2006, when they rose 3.8 percent, a Labor Department official said. Core prices were up 2.2 percent on a year-on-year basis.

So far this year, prices have climbed by a seasonally adjusted annual rate of 3.6 percent, driven by higher food and energy costs. That compares with a 2.5 percent gain in all of 2006.

Energy costs have surged at a 12.3 percent annual rate this year, more than four times higher than the 2.9 percent gain in all of last year. Food prices increased at a 5.5 percent annual rate in 2007, compared with a 2.1 percent rise in 2006.