Apple Inc. delivered its best-ever revenue for what is typically its weakest quarter, as demand for high-price iPhones remained resilient and services such as app-store sales swelled to a record.

The results for Apple’s fiscal third quarter show how the iPhone maker is finding ways to grow amid a contracting global smartphone market that is roiling its rivals.

“We’re...