Correction: This story has been updated to correct that Apple sold 32.1 million iPhones duringits third quarter, not 32.1 billion.

Apple coasted over lowered analyst expectations for its third quarter Tuesday on unexpectedly strong sales of its iPhone, the company’s most important product line, sending the stock up in after-hours trading.

The company reported earnings of $7.47 per share by racking up $35.3 billion in revenue. It sold 32.1 million iPhones, despite newer offerings such as Samsung’s Galaxy S4 and the HTC One. Analysts had predicted Apple would sell 27 million iPhones.

Ramon Llamas, a researcher with International Data Corp., said the iPhone can still stand up to stiff competition and probably benefited from new carrier partnerships, most notably with T-Mobile U.S.

“In what is normally a down quarter, it looks like Apple is able to withstand such competitive pressure from everybody else,” Llamas said. Apple’s shares were up nearly 4 percent in after-hours trading.

But Apple’s profits from the quarter, $6.9 billion, dropped from the same period last year, when the company earned $8.8 billion.

That decline, despite higher sales, can be attributed to strong sales of older iPhone models, some analysts said. That underscores concerns that the company may not be able to deliver high profit margins from smartphone buyers who may have become less likely to go for pricey devices.

In the United States, the newest iPhone 5 costs $200, but only because carriers cover some of the actual cost. Overseas, where older models are more popular, the smartphones are far more expensive. “The $450 market and up is slowing,” said Carolina Milanesi, a consumer devices analyst for Gartner. “Growth is more from the $250 price point.”

On a conference call with analysts, Apple chief executive Tim Cook rejected the idea that demand for high-end smartphones will give way to cheaper products.

“I don’t subscribe to the common view that the higher end of the smartphone market has hit its peak,” Cook said.

News was not quite as rosy in the company’s other business lines. Apple sold 14.6 million ­iPads; analysts had expected sales of 17 million, in line with numbers from the same period last year. Mac sales were down to 3.8 million from 4 million in the third quarter of 2012.

Analysts said Apple will have to decide soon whether to continue releasing one new phone per year, with major upgrades coming every two years, or whether to accelerate its schedule to meet the pace set by competitors such as Samsung. Executives on the conference call said the firm is preparing for a “very busy fall” but did not give further details.

The firm also faces questions about whether it can maintain its success in the smartphone and tablet market and preserve its reputation as a tech innovator.

Milanesi said Apple cannot simply introduce more products to fill that competition gap. She said it will have to deliver a number of high-end products — tablets, computers and software services — to keep its most valuable customers.

“Others look at their businesses in isolation,” she said. “Apple is about making sure all products are compelling so that overall you stick to the ecosystem.”

Sign up today to receive #thecircuit, a daily roundup of the latest tech policy news from Washington and how it is shaping business, entertainment and science.