However, Apple also reduced its outlook for the second half of its fiscal year.
Excluding a gain and a write-down related to its investment portfolio, Apple earned $40 million, or 11 cents a share, in its second quarter on revenue of $1.43 billion.
Although analysts' predictions varied considerably, the consensus estimate was for earnings of 1 cent a share, according to First Call. Revenue was expected to be $1.38 billion for the quarter, which ended March 31.
In its second quarter last year, the Cupertino, Calif.-based computer maker earned $233 million, or 64 cents a share, on revenue of $1.95 billion.
The quarterly earnings are in sharp contrast to a brutal $247 million operating loss in Apple's fiscal first quarter.
"We had a lot to accomplish in the March quarter, and we're very pleased that our results exceeded expectations in a very challenging environment," Apple Chief Financial Officer Fred Anderson said on a conference call with analysts.
Hot Apple turnaround
Carl Howe, principal analyst, Forrester Research
"We're taking into account the tough environment we're in," Anderson said.
Apple shares surged 15 percent to $26.17 in after-hours trading, according to Island ECN. In regular trading ahead of the report, Apple shares rose $2.39, or 12 percent, to close at $22.79.
The computer maker said it shipped 751,000 Macintoshes during the quarter. The company added that it reached its goal of having four weeks of inventory in the hands of retailers and distributors, which Apple says is ahead of schedule. Anderson said the company had previously predicted it might take a few quarters to reach the four-week level.
In its second quarter, Apple recorded an $89 million after-tax gain from selling part of its stock in chip designer ARM Holdings, but that was largely offset by an $86 million write-down of some of its equity investments. Including the investment gain and write-down, Apple earned $43 million, or 12 cents a share.
Falling prices for parts helped boost Apple earnings, Anderson noted.
"Component costs continued to soften during the quarter, and we were able to take advantage of that," he said.
Anderson characterized Apple's Titanium PowerBook G4 as a hit, saying the company shipped 115,000 of the notebooks in the quarter and expects to reduce its backlog of orders for the sleek portable to a normal level by the end of April.
PowerBook sales were indeed the bright spot, with shipments of both old and new models up about a third from the same quarter last year in terms of both units and dollars. By contrast, Apple shipped 37 percent fewer iMacs and brought in 47 percent less revenue from the consumer desktops. Unit shipments of iBooks were off 52 percent and revenue was down 47 percent. PowerMac shipments dropped about 30 percent in terms of units and dollars.
Apple shipped 12,000 of its slow-selling G4 Cubes in the quarter, down from the already disappointing 29,000 it sold the prior quarter. There are no year-ago figures because Apple introduced the model in July.
Apple's revenue figures represent its online sales and shipments to distributors and retailers, but do not track directly to retail sales.
Anderson said Apple brought in about one-third of its revenue from its online store.
The company said in January that it would report a slight profit in its second quarter.
David Bailey, an analyst at Gerard Klauer Mattison, said strong sales of Apple's corporate products, particularly the new PowerBook, helped the company to beat predictions.
"That's really what allowed them to come in ahead of expectations," said Bailey, who had forecast Apple would earn 2 cents a share.