Record sales of iPhones and iPads offset weaker-than-expected sales of Macs and iPods, catapulting Apple to yet another record-setting quarter. Apple posted a net profit of $13.1 billion on revenues of $54.5 billion for the fourth quarter of 2012—both records for the consumer electronics giant.

Related: Nokia Sold 4.4 Million Lumias in Q4, But Only 700,000 in North America

“We’re thrilled with record revenue and sales of over 75 million iOS devices in a single quarter,” Apple CEO Tim Cook said in a prepared statement. “We’re very confident in our product pipeline as we continue to focus on innovation and making the best products in the world.”

Apple sold 47.8 million iPhones in the quarter, in line with analyst expectations but not a strong enough showing to unseat Samsung as the biggest smartphone maker in the world. And although that number is a record for Apple—in the same quarter a year ago, Apple sold 37 million iPhones—it’s not clear how many were iPhone 5 handsets and how many were the two older versions of the product Apple continues to sell. For example, Verizon reported this week that over half of all iPhones it sells are aged models like the iPhone 4 (which dates all the way back to mid-2010) and the iPhone 4S (from 2011).

Apple also sold a record 22.9 million iPads in the quarter, a significant jump over the 15.4 million it sold in the same quarter a year ago. Sales of the iPad were no doubt helped by the introduction of the iPad mini, which starts at just $329 in the United States, a full $170 less than Apple’s cheapest full-sized iPad. (Apple also continues to sell a two-year-old iPad 2, aping its iPhone strategy.) It’s not clear yet how badly iPad mini sales cannibalized sales of the more expensive devices.

Sales of Macs and iPods were down year-over-year. Apple sold just 4.1 million Macs, compared with 5.2 million in the year-ago quarter. Worse still, this figure is well below the 4.8 to 5.3 million Macs that analysts had expected. Apple’s iPod sales came in at 12.7 million units, down from the 15.4 million it sold a year before but roughly in line with analyst expectations.

Another bit of bad news: Apple’s stellar margins are starting to collapse as it seeks ever-bigger unit sales through the continued sales of older, less expensive versions of its products. Gross margins in the quarter were 38.6 percent—still an amazing figure—compared with 44.7 percent in the year-ago quarter. Apple warned that this could fall as low as 37.5 percent in the current quarter.

Apple says it generated over $23 billion in cash flow in the quarter and has declared a cash dividend of $2.65 per share. The dividend is payable on February 14, 2013, to shareholders of record as of the close of business on February 11, 2013.