Apple Inc reported much better-than-expected quarterly margins on record sales of iPhones and Mac computers, driving a big jump in quarterly revenue and earnings.

The stock fell in after-hours trading, erasing its gains of 2.7 percent on Nasdaq before the close. Investors had also snapped up the stock days ahead of the hugely anticipated Wednesday launch of 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. Mac sales continued to show momentum, rising 33 percent from a year ago to 3.36 million units. Analysts, on average, had expected sales of about 3 million Macs.

Gross margin came in at 40.9 percent, up from 37.9 percent a year ago and trouncing Wall Street's estimate of 35.8 percent.

Although Wall Street is already looking ahead to Wednesday's tablet announcement, Apple's holiday quarter results 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, when the old accounting standard was used.

Revenue rose to $15.68 billion from $11.9 billion.

Apple forecast earnings for the current quarter of $11 billion to $11.4 billion on earnings of $2.06 to $2.18 a share.

Apple shares have more than doubled over the past 12 months. The stock fell to around $200.55 after closing at $203.08 on Monday.

(Reporting by Gabriel Madway; Editing by Richard Chang)