SAN FRANCISCO — Apple's sales of older, less expensive iPhones climbed in its latest quarter, highlighting the challenges facing the world's most valuable technology company as it tries to reverse a recent decline in its earnings and prove that it can still innovate.

The results announced Tuesday topped the projections of analysts who steer the way investors tend to react to financial reports. That helped lift Apple's stock by $16.39, or nearly 4 percent, to $435.38 in extended trading after the numbers came out. The shares still remain down more than 35 percent since the latest model of the iPhone came out 10 months ago.

The downturn largely reflects the intensifying competition in the smartphone and tablet computer markets. Apple defined and then dominated those markets for several years to propel the company into a hyper-growth phase that enthralled Wall Street. But there are now signs that Apple's once seemingly irrepressible growth is stalling as rivals such as Google Inc., Samsung Electronics and Amazon.com Inc. make inroads largely by undercutting Apple's prices.

The competitive pressure has prompted Apple to sell older models of its iPhones at prices below the newest model and introduce a smaller, less expensive version of its iPad.

The impact of that shift can be seen in Apple's fiscal third quarter, a three-month period ending in June.

It marked the second straight quarter that Apple Inc.'s earnings have fallen from the previous year after a decade of steadily rising profits. The company earned $6.9 billion, or $7.47 per share, in its fiscal third quarter, a 22 percent drop from $8.8 billion, or $9.32 per share. The earnings topped the average estimate of $7.31 per share among analysts surveyed by FactSet.

Apple's revenue during the quarter barely budged from last year, resulting in the smallest gain since the Cupertino, Calif., company unleashed a mobile computing revolution with the iPhone's debut six years ago.

Revenue totaled $35.3 billion in the latest quarter versus $35 billion a year ago. Analysts had projected that revenue would be unchanged from a year ago.

The mid-range of Apple's forecast for the current quarter ending in September calls for revenue of $35.5 billion, which would be a slight decline from last year. The company didn't predict what its earnings will be for the current year, but analysts are bracing for another decrease from last year.

In a Tuesday research note, Topeka Capital analyst Brian White said the quarter ending in September will cap "a year to forget" for Apple. He is counting on the company to do better during its next fiscal year, largely because he believes Apple will invent a new line of devices.

Apple hasn't released a breakthrough product since the iPad came out three years ago, raising concerns the company has lost its touch since the October 2011 death of founder Steve Jobs.

Tim Cook, who succeeded Jobs as Apple's CEO, tried to assure analysts that the company can still innovate, echoing a common theme he has raised in other public appearances this year. "We are working on some things we are really proud of," he said during a conference call Tuesday. "We will see how it does and announce things as we are ready."

There has been recurring speculation that Apple is working on a high-tech watch that can be tethered to an iPhone to allow people to see important updates and other online information simply by looking at their wrists. Both Jobs and Cook have hinted in past years that Apple is working on a new product that will revolutionize televisions the same way that the company changed the way people use phones and tablet computers. Cook didn't mention a watch or new TV product during Tuesday's call.

"Apple is clearly in between innovation cycles, so Wall Street is going to hyperventilate," Forrester Research analyst Frank Gillett said.

If Apple follows its usual schedule, the next generation of the iPhone will hit the market in September or October.

In the meantime, a growing number of people are buying older models of the iPhone, particularly in less developed countries where incomes are lower. The iPhone 4 and 4S sell for less than the latest version, the iPhone 5, yet can still run the latest software.

This phenomenon helped Apple sell 31.2 million iPhones in the quarter, a 20 percent increase from the same time year ago.

But the shift to the older models undercut Apple's profit margins. The iPhone sold for an average of $581 in the past quarter, down from an average of $608 a year ago.

Consumers typically don't pay anywhere near those prices for iPhones because they get discounts from wireless carriers in return for two-year contract commitments. Most U.S. wireless carriers sell the iPhone 5 for $199 and the 4S for $99. The iPhone 4 is usually free with a contract commitment.

IPhone prices would fall even further if Apple decides to design a cheaper model aimed specifically at lower-income countries.

Cook is hoping the iPhone's shrinking average sale price benefits Apple in the long run by introducing more first-time buyers of smartphones to the company's products, including its iTunes store for music, video, books and apps. Revenue tied to iTunes, software and services climbed by 25 percent from last year to $4 billion.

The intensifying battle in the iPad market clipped Apple in the latest quarter. The company sold 14 percent fewer tablets — 14.6 million in the past quarter compared with 17 million a year ago. The average iPad's price plunged 15 percent from last year to $436, down from $515 last year.

The sharp decline reflects Apple's decision to sell a smaller version of the iPad at the end of last year to counter the threat posed by mini tablets sold by Google, Amazon and other rivals.

Google is expected to unveil the next generation of its Nexus tablets on Wednesday in San Francisco. The current Nexus tablet with a seven-inch display screen and 16 gigabytes sells for $199, 40 percent below the price for an iPad Mini with an eight-inch display and the same amount of storage.