The June data eased from 3.1 percent in May and was below market estimates mostly ranging from 3.1 percent to 3.5 percent.
The inflation rate stood at 2.6 percent in the first half of this year, according to the NBS. It was below the 3 percent target ceiling for the year set by the government in March.
In the first six months, consumer prices in China's urban areas increased 2.5 percent and in rural regions by 2.8 percent. Food prices, which account for about a third of the weighting in calculating the CPI, gained 5.5 percent.
In June alone, food prices rose 5.7 percent year on year, according to the NBS.
"China's inflation in the first half was mild and within the range of management," NBS spokesman Sheng Laiyun told a news conference.
China's Producer Price Index (PPI) grew 6.4 percent year on year in June, Sheng said, adding the figure for the first six months was 6.0 percent up from a year ago.