SAN FRANCISCO (Reuters) - Apple Inc’s quarterly profit blew past Wall Street forecasts thanks to strong sales of Macs and iPhones and higher-than-expected gross margins, sending its shares up more than 3 percent on Tuesday.

Customers look at the Apple iPhone 3GS at the company's retail store in San Francisco, California June 19, 2009. REUTERS/Robert Galbraith

The company defied the global economic recession and 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.

“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.”

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 had launched its third-generation iPhone 3GS and cut the price on the second-generation model to $99.

The company said almost 20 percent of Fortune 500 companies have bought at least 10,000 iPhones, and it is currently unable to make enough iPhone 3GSs to meet a demand -- a problem Apple is working to address.

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

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

“The overall takeaway is that Apple continues to execute in this tough environment,” said Kaufman Bros analyst Shaw Wu. “We think they are very uniquely positioned with their competitive advantages. They do the hardware, software and service, and that really allows them to have a leg up against competitors.”

OUTLOOK CONSERVATIVE

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.

Slideshow ( 2 images )

“The forecast for Q4 is strong relative to what I thought they were going to do,” said Pacific Crest’s Hargreaves.

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

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

Investors have snapped up Apple’s stock this year, pushing it up at a pace well ahead of other big technology issues.

In an interview with Reuters, Apple Chief Financial Officer Peter Oppenheimer said back-to-school-sales are in their early stages but started off well.

“We hit the ball out of the park with Mac sales,” he said. “In a better economy we’d be selling more.”

Apple shipped 10.2 million iPods in the quarter, down 7 percent year on year. The CFO said he expects sales of traditional iPods to decline over time, cannibalized by the iPhone and iPod Touch.

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