What happened

Shares of tech giant Apple (AAPL 1.27%) popped on Wednesday. As of noon EDT, the stock was up 7.1%.

The gain followed Apple's better-than-expected fiscal second-quarter results. Revenue, earnings per share, and guidance were above what analysts were anticipating.

A hand holding an iPad Pro

Apple's redesigned iPad Pro, which was launched late last year, helped the company record its highest quarterly iPad revenue growth rate in six years. Image source: Apple.

So what

Apple's revenue fell 5% year over year to $58 billion but beat analysts' average forecast for revenue of $57.4 billion. Earnings per share declined 10% year over year to $2.47, beating a consensus estimate for $2.36.

A 17% year-over-year decline in iPhone revenue weighed on results. But record services revenue and strong growth in Apple's iPad and wearables, home, and accessories segments helped offset some of this headwind.

Now what

Apple guided for fiscal third-quarter revenue between $52.5 billion and $54.5 billion. The midpoint of this range is notably above the $53.3 billion in fiscal third-quarter revenue Apple reported last year. In addition, this guidance range is above analysts' forecast for third-quarter revenue of $51.9 billion.

Management also said it expected its fiscal third-quarter gross margin to be between 37% and 38%. This compares with a gross margin of 38.3% in Apple's third quarter of 2018.