Apple Inc. said its quarterly profit fell 27% as the company grappled with the first prolonged slump in iPhone sales since the product was introduced in 2007.

Revenue fell for a second straight quarter, along with sales of its flagship smartphone, which is awaiting an expected refresh in September.

While the company reported strong sales...