Apple Inc's quarterly profit blew past Wall Street forecasts thanks to strong sales of Macs and iPhones and higher-than-expected gross margins, boosting its shares 4 percent on Tuesday.

The company continued to defy the global recession with a solid 13 percent jump in fiscal third-quarter net profit. It sold more than seven times as many iPhones — 5.2 million units of its latest signature device — as the year-ago period.

"The numbers are great. Their gross profits continue to surprise people and there is a return to product momentum ... a return to growth in the Mac business," said Andy Hargreaves, an analyst at Pacific Crest Securities. "And then the iPhone is doing tremendously well and that is a potent combination."

Apple reported a net profit of $1.23 billion, or $1.35 a share, for its fiscal third quarter ended June 27, up from $1.07 billion, or $1.19 a share, in the year-ago period.

Earnings per share beat by far the average Street forecast of $1.18 according to Reuters Estimates, and topped even the most bullish "whisper" numbers of $1.30 to $1.35.

Sales of Macs and iPhones both beat analysts' expectations, helped by product refreshes and lower prices, while iPod shipments were toward the low end of forecasts.

Apple said it sold 2.6 million Macs, up 4 percent from a year ago, and 5.2 million iPhones in the June quarter, during which the company launched its third-generation iPhone 3GS and cut the price on the second-generation model to $99.

The iPhone is often thought of as more of a consumer device, but Apple said nearly 20 percent of Fortune 100 companies have bought at least 10,000 units and it is unable to make enough iPhone 3GSes to meet demand — a shortfall the company said it is working to address.

Although the smartphone segment continues to grow more crowded with competitors, Chief Operating Officer Tim Cook said on a conference call the company is "years ahead of other people" in its competitive position.

IPHONE DRIVES

The install base for the iPhone and the iPod Touch — which share operating systems — is now 45 million, Apple said.

"The iPhone is the biggest driver right now, because the profitability is really high," said Frost & Sullivan analyst Ronald Gruia. "It's been an absolute success."

Yet there had been some concern about margin pressure heading into the results, given the product price cuts and the trend of higher component costs.

Although Mac units rose, revenue in the segment fell 8 percent from a year ago as average selling prices came down, a trend seen throughout the PC industry.

But Apple posted a gross margin of 36.3 percent, above the 34 percent some analysts predicted. That compared with 36.4 percent in the last quarter and 34.8 percent a year ago. The company saw margins at 34 percent in the September quarter.

Apple said component costs rose, but not as much as expected and it spent less than it planned in several areas.

"The overall takeaway is that Apple continues to execute in this tough environment," said Kaufman Bros analyst Shaw Wu.

"They do the hardware, software and service, and that really allows them to have a leg up against competitors."

Investors have pushed Apple's stock about 75 percent higher this year, well ahead of other big technology issues.

Apple issued a typically conservative outlook for the current quarter, forecasting earnings of $1.18 to $1.23 a share on revenue of $8.7 billion to $8.9 billion.

While that was below the average analyst estimate of $1.30 in earnings per share and $9.1 billion in revenue for the fiscal fourth quarter, it had little impact on investors.

Revenue rose 12 percent to $8.3 billion in the June quarter, versus analysts' average estimate of $8.2 billion.

Cash and marketable securities totaled more than $31 billion, one of the biggest cash hoards in all of technology.

The results demonstrated the consumer appeal of Apple's products despite a troubled economy that has dented sales at competitors selling less expensive products.

Apple reported relative strength in consumer demand, and weakness in education, one of its key markets.

But iPods were a chink in its armor. Apple shipped 10.2 million iPods in the quarter, down 7 percent on the year. As iPod sales slow down, analysts see alternative catalysts on the horizon, with the expected launch of an iPhone in China and a rumored tablet PC or Internet device in the works.

Cook said the company hoped to have an iPhone in China within a year.

Chief Executive Steve Jobs did not make an appearance on the company's conference call, despite rumors that he might. Jobs recently returned from a nearly six-month medical leave, where he underwent an a liver transplant.

Shares of Cupertino, California-based Apple closed at $151.51 on Nasdaq and rose to $158.34 in extended trading.