New York (CNN Business) General Mills, the owner of supermarket staples Cheerios, Haagen-Dazs ice cream and Progresso soup, said Wednesday that its latest earnings topped forecasts — largely because of higher prices.

The company, which also owns Wheaties, Lucky Charms and Annie's, said that the actual sales volume of its products fell in North America and Europe during the quarter, although they did rise in Asia.

But thanks to price increases — as well as a boost from buying pet food maker Blue Buffalo last year — total sales still rose 8% compared to a year ago.

General Mills needed to raise prices to protect its profit margins, which were threatened by rising dairy inflation, Chief Financial Officer Donal Mulligan told analysts Wednesday. The company owns Yoplait, the yogurt maker.

It also helps to have some brands that people are willing to pay higher prices for. Although overall sales volume fell in the United States, General Mills still has several well-known brands that are very popular with consumers.

Read More