Amazon.com Inc's retail and cloud-computing sales rose in the first quarter, inching above Wall Street's expectations and sending the company's shares to an all-time high in extended trading.

The world's largest online retailer said on Thursday net sales rose 23 percent to $35.7 billion, just beating analysts' average estimate of $35.3 billion, according to Thomson Reuters I/B/E/S.

More fees from Amazon's Prime shopping club and media streaming services, along with growing advertising revenue, also boosted results.

Profit, which has traditionally been fleeting at a company that focused on growth, was also ahead of expectations. Net income rose 41 percent to $724 million, or $1.48 per share, marking the eighth straight quarter that the company posted a net profit. Analysts on average were expecting $1.12 per share.

Amazon's revenue has soared in recent years as shopping has moved online and businesses have moved their computing operations to the cloud, where Amazon Web Services (AWS) is the biggest player. AWS accounts for a majority of Amazon's operating profit.

Some investors worried that mounting competition from rival cloud providers like Microsoft Corp and price cuts at AWS would slow the company's momentum. Many also expected Amazon's staggering array of investments - from new warehouses, TV and movie production to research on artificial intelligence - to weigh on profits.

But those fears proved unfounded for the first quarter.

"The core e-commerce segment remains very healthy," said Colin Sebastian, an analyst at Baird Equity Research. "Subscription services and advertising are growing much faster, and beginning to move the needle, which also helps increase profit margins."

Shares of the company rose 3.9 percent to $954 in after-hours trading, adding nearly $3 billion to the personal fortune of founder and Chief Executive Jeff Bezos.

Heavy Spending

Amazon Prime, which offers fast shipping and video streaming to members, helped raise the company's subscription sales 49 percent from a year earlier to $1.9 billion. Sign-ups have been key to Amazon's strategy because Prime encourages shoppers to buy more goods, more often.

Revenue from a co-branded credit card deal and from third-party sellers paying to promote their products on Amazon.com also rose 56 percent to $850 million.

That is “about Twitter’s size, which is pretty good,” said Wedbush Securities analyst Michael Pachter.

Sales from AWS, the company's fast-growing business to host companies' data and handle their computing in the cloud, rose 42.7 percent to $3.66 billion, matching the average analyst estimate, according to market research firm FactSet StreetAccount.

Amazon posted an operating loss of $481 million in its international segment, however - four times its loss a year earlier for the segment. The company has said it is investing more than $5 billion in India to gain market share, and this month it announced plans for a retail marketplace in Australia.

"A lot of the same playbook you’ve seen working in the U.S. is also being rolled out internationally," Amazon Chief Financial Officer Brian Olsavsky said on a conference call with reporters.

Seattle-based Amazon forecast that operating income in the second quarter would be between $425 million and $1.075 billion, below the average estimate of $1.46 billion, according to FactSet StreetAccount.

Across the board, the company is stepping up investments from a year ago. It plans to build new warehouses and create more than 130,000 full-time and part-time jobs by mid-2018 to speed up delivery. It is racing to make its voice assistant Alexa, which competes with Apple Inc's Siri, a ubiquitous platform like Windows has been for desktop or Android has been for phones.

Some analysts believe Amazon is sitting atop a new revenue stream from shoppers ordering goods by voice. While Alexa devices now allow for this, Amazon is focused more on making the gadgets useful, Olsavsky said on a call with analysts.

“Monetization, as you might call it, that's not our primary issue right now,” Olsavsky said of Alexa devices. "We're doubling down on that investment.”

The company forecast sales for the second quarter of between $35.25 billion and $37.75 billion, which includes an unfavorable impact of about $720 million from foreign exchange rates.