The world’s most valuable technology company also forecast revenue above expectations for the fall, when it typically launches new iPhone models, reassuring a nervous tech sector that saw sell-offs last week in Facebook Inc, Twitter Inc and Netflix Inc on concerns about their future growth.

And a $20 billion stock buyback in the quarter spurred by sweeping U.S. corporate tax cuts brought Apple’s buyback tally this year to a record $43 billion and exceeded the stock market value of almost three-quarters of the companies in the S&P 500.

“The lesson Apple’s management has learned from the iPhone X, is when you sell a smartphone for more than $1,000 you can sell fewer units and still reap the financial benefits,” said analyst Thomas Forte from D.A. Davidson & Co.

Shares rose 3.7 percent in extended trade to $197.34, a record high, putting its market capitalization at $954 billion. The stock would need to hit $206.49 for Apple to become the first publicly traded U.S. company to cross the $1 trillion threshold, based on Apple’s share count at the end of the quarter. Apple may have reduced its share count since then.

Apple sold 41.3 million iPhones in the fiscal third quarter, half a million less than expected, but the average iPhone selling price topped expectation by $30, hitting $724, according to FactSet. Apple Chief Financial Officer Luca Maestri told Reuters that customers were buying costlier models and the $999 iPhone X was the quarter’s best seller.

Apple posted third-quarter revenue of $53.3 billion and profits of $2.34 per share, compared with analyst estimates of $52.3 billion and $2.18 per share, respectively, according to Thomson Reuters I/B/E/S.

It also forecast revenue of $60 billion to $62 billion for its fiscal fourth quarter, which will include early sales of soon-to-be-announced phone models, beating the $59.6 billion analysts expected, according to data from Thomson Reuters I/B/E/S.

Despite the beat, James Cordwell, an analyst from Atlantic Equities, said the high selling prices might cause investors some concern because “there’s a limit to how much Apple can grow the iPhone franchise by pushing pricing.”

Apple services include streaming music and video, where Apple faces competition from rivals including Spotify Technology SA and Netflix.

But several of Apple’s services do not face strong rivals. Maestri told Reuters that sales from Apple Care, the company’s warranty offering, were up 27 percent versus a year ago.

Apple’s biggest selling products do not yet face duties stemming from the U.S.-China trade disputes, but President Donald Trump has threatened hundreds of billions of further tariffs whose product categories have not yet been enumerated.

Apple is looking at whether it will be hit by tariffs on purchases the company must make, possibly related to data centers, Chief Executive Tim Cook said on a conference call with investors.

He credited “wearables”, a category which includes wireless earphones and the Apple Watch, with making growing contributions, and the Watch could be hit by tariffs. Maestri told Reuters that Apple could not keep up with demand for AirPods headphones.

Services revenue was $9.5 billion, beating analyst expectations of $9.1 billion, according to Thomson Reuters I/B/E/S. The revenue included $236 million from resolving lawsuits such as Apple’s long-running dispute with Samsung Electronics Co Ltd.

Apple executives emphasized the recurring nature of much of that revenue, saying the company had reached 300 million subscriptions on its devices, a figure that includes both Apple’s own services such as music and third-party subscriptions such as Netflix, where Apple takes a cut of the revenue when it handles the billing.

Cook said Apple Music has more than 50 million users when free trials are counted and hinted at the company’s video content efforts. Apple has hired prominent television executives from Sony Corp and started making deals for content such as a dramatic series with Hollywood stars Reese Witherspoon and Jennifer Aniston.

Apple has yet to say how it will distribute those shows or how much it will charge, but Cook said Apple is “thrilled about our pipeline that have some new services in it.”