Apple Inc reported record sales of Mac computers and stronger-than-expected gross margins, but iPhone sales were slightly below some of Wall Street's most bullish forecasts.

Apple's stock edged higher in after-hours trading, after closing up 2.7 percent on Nasdaq before the news. Investors had also snapped up the stock ahead of the Wednesday launch of a product expected to be a tablet computer.

Apple said on Monday it shipped 8.7 million iPhones in the holiday quarter, just short of the Wall Street target of roughly 9 million. Apple's iPhones compete with Research in Motion's BlackBerry and other smartphones,

Mac sales continued to show momentum, rising 33 percent from a year ago to 3.36 million units. Analysts' average estimate was about 3 million Macs.

Gross margin rose to 40.9 percent from 37.9 percent a year ago, trouncing Wall Street's estimate of 35.8 percent, on a continued shift toward higher-margin products like Macs and iPhones.

Mac sales were very strong, which more than offset what might be perceived as a ho-hum iPhone number, said Bill Kreher, an analyst with Edward Jones.

Maybe some on the Street were getting a little euphoric with their expectations on the iPhone.

Although Wall Street is already looking ahead to the tablet announcement, Apple's holiday-quarter results may have provided the company with a strong start to the week.

Apple, which has surpassed Wall Street expectations for earnings per share by at least 15 percent in the past four quarters, adopted new accounting standards for its fiscal first quarter.

The company posted net income of $3.38 billion, or $3.67 a share in the fiscal first quarter ended December 26, up from $2.26 billion, or $2.50 cents a share, in the year-ago period.

Revenue rose to $15.68 billion from $11.9 billion.

Analysts had expected Apple to earn $2.09 per share on revenue of $12.09 billion, according to Thomson Reuters I/B/E/S, but it was not clear if the numbers were comparable given the surprise accounting change.

There is a bit of confusion because the consensus numbers are somewhat meaningless (due to new accounting). There is a state of confusion, said Kaufman Bros analyst Shaw Wu. What we do know is the iPhones were light. People were looking for closer to 9.5 (million).

Apple forecast earnings for the current quarter of $2.06 to $2.18 a share on revenue of $11 billion to $11.4 billion. Wall Street analysts, on average, had expected earnings of $1.77 a share on revenue of $10.37 billion, but again it was unclear if those estimates were comparable.

Apple's stock has more than doubled over the past 12 months. The stock rose above $205 after closing at $203.08 on Monday.

Apple has reached its distribution profile by and large that it's going to reach for the iPhone, said Gartner Research analyst Van Baker. So you would expect that growth would slow somewhat because now it becomes a replacement market as opposed to a new user market.

(Writing by Edwin Chan; Editing by Richard Chang)