The results suggested that the issues causing Apple’s business to shrink in China and elsewhere in recent months had been resolved — or at least temporarily patched.

Apple had blamed some of its struggles in China on the country’s slowing economy and its trade war with the United States. Luca Maestri, Apple’s finance chief, said in an interview on Wednesday that those issues were subsiding.

“These trade tensions have not been helpful to the Chinese economy and to our business, and we think that as you’ve seen from our results, the peak of those tensions were at the beginning of the year,” he said.

Apple got off to a rocky start this year when it cut revenue forecasts because of slow sales in China, prompting a sharp sell-off of its stock. Since then, Apple’s financials have improved and its market value has rebounded. Apple shares rose about 2 percent in after-hours trading on Wednesday.

“The company is still benefiting from low expectations, from when they set the bar really low” in January, said Tom Forte, an analyst at D.A. Davidson. “And since then, they’ve been telling a different story, which is that they’re pivoting to be less dependent on the iPhone.”