Apple Incc. delivered its best-ever revenue for the June quarter, typically its weakest period, as demand for high-price iPhones remained resilient and services like app-store sales swelled to all-time highs. The results for Apple’s fiscal third quarter show how the world’s most valuable company is finding ways to grow amid a contracting global smartphone market that is roiling its rivals. “Growth was strong all around the world,” Apple finance chief Luca Maestri said during an interview. Though iPhone sales usually weaken in the spring and summer as anticipation builds for new devices expected in September, Mr. Maestri said demand has remained consistent, particularly for the iPhone X, 8 and 8 Plus. “Customers are really valuing the features in the products,” he said. Shares of Apple, up 28% over the past year, rose 3.6% to $197.01 in after-hours trading. Apple’s move to raise iPhone prices continued to pay off in the period with sales of its flagship product rising 20% to $29.91 billion even as shipments rose less than 1% to 41.3 million. Meanwhile, the company’s services business reported record revenue of $9.55 billion, a 31% increase from a year ago, strengthening the case that Apple is in the midst of a transformation from a device-driven business into one increasingly reliant on sales of subscriptions and software. The combination drove total revenue up 17% to $53.26 billion in the latest period, above Wall Street expectations and near the high end of its own guidance. Profit rose 32% to $11.52 billion, or $2.34 a share, also above analysts’ consensus estimates. Apple signaled it expects to sustain strong iPhone sales in the current quarter with a forecast for total revenue of between $60 billion and $62 billion, which would represent a healthy 14% to 18% increase from a year ago. The expected jump reflects a small boost from a trio of new devices the company is expected to release in September, analysts say, including an update to the $999 iPhone X, its first oversize phone with an organic light-emitting diode, or OLED, display and a 6.1-inch LCD phone with facial recognition technology. The new phones are projected to be priced between $699 for the LCD device and $1,099 for the plus-size handset, according to UBS, potentially ensuring another year of higher average iPhone prices to lift Apple’s total revenue. Analysts had estimated the $999 iPhone X made up one-quarter of total iPhones sold, which helped lift average selling prices per iPhone by nearly 20% to about $724. While sales of the company’s handsets have been more pedestrian so far this fiscal year than the more than 7% increase in annual iPhone shipments many analysts forecast a year ago, features like the iPhone X’s facial recognition and edge-to-edge display have been enough to help Apple deliver modest growth and revive a China business mired in a multiyear slump. The company said revenue in Greater China, where sales tanked in 2016, rose 19% to $9.55 billion. Apple’s chief rival, Samsung Electronics Co. , hasn’t fared as well. The South Korean company, which also has raised smartphone prices to nearly $1,000, reported a big decline in mobile phone profits on Tuesday as consumers hold on to devices longer and balk at higher prices. Samsung has seen its market share in China fall as homegrown rivals like Huawei Technologies Co. increase sales.