(Reuters) - Amazon.com Inc AMZN.O on Thursday reported its first profit miss in two years and said income would slump in the current quarter, as the online retailer ramps up spending on one-day delivery to spark sales growth.

FILE PHOTO: The logo of Amazon is seen at the company logistics centre in Boves, France, January 19, 2019. REUTERS/Pascal Rossignol/File Photo

The company also said its investment in faster shipping was starting to pay off, with revenue rising 20% to $63.4 billion in the second quarter ended in June. That topped analysts’ estimates and the 17% rate of growth that Amazon posted in April.

Shares fell more than 1% in after-hours trade.

Seattle-based Amazon has drawn more than 100 million paid subscribers to its loyalty club Prime by releasing original TV shows, equipping more gadgets with its voice assistant Alexa and offering quick shipping for countless goods, including groceries from its subsidiary Whole Foods Market.

Now, it is investing heavily to halve delivery times to one day for Prime members, to stay ahead of rivals such as Walmart Inc WMT.N that have marketed two-day shipping without subscription fees. So far Amazon has expanded one-day delivery to more than 10 million items, a fraction of the 100 million-plus goods it offers in two days in the United States.

The cost slightly exceeded the $800 million Amazon had forecast it would spend on the initiative in the second quarter, Chief Financial Officer Brian Olsavsky said on a call with reporters. (Graphic: tmsnrt.rs/2y7OGJN)

“Right now we are seeing an increasing and ramping cost penalty, and that’s what’s built into the Q3 guidance,” Olsavsky said, adding that most of the work to roll out single-day delivery outside the United States lies ahead of the company.

Amazon’s profit inched up to $2.6 billion in the quarter, short of $2.8 billion that analysts were expecting, according to IBES data from Refinitiv. Operating expenses had jumped about 21%.

The money Amazon is sinking into delivery shows how the world’s largest online retailer is not immune to competition, said Neil Saunders, managing director at research firm GlobalData.

“It is a necessary evil,” Saunders said. “Amazon exists in a world where a lot of retailers have the advantage of allowing customers to pick things up the same day in stores,” with far larger brick-and-mortar footprints than Amazon can boast.

SLOWING CLOUD?

Amazon’s slowing revenue growth has in part reflected the evolving nature of its business. The company is gradually moving away from low-margin retail toward a marketplace model where it collects lucrative fees for helping other merchants on its site ship and advertise their products.

Revenue from seller services grew 23% to $12.0 billion in the second quarter, while ad and other sales increased 37% to $3.0 billion.

Though profitable, the dual retail and marketplace model has drawn scrutiny. Earlier this month, the European Commission launched an antitrust probe into whether Amazon’s use of other merchants’ data offered an unfair advantage to its retail unit, which has made private-label versions of popular products.

The U.S. Justice Department also said Tuesday it would look into whether Big Tech engaged in any anticompetitive practices, including in online retail.

Olsavsky declined to discuss the matter.

At the same time, sales growth for Amazon's cloud unit fell below 40% for the first time in years. The unit, which handles data storage and computing operations for other enterprises, raked in $8.4 billion in revenue in the second quarter, or 37% more than the year prior. Nascent competitor Google GOOGL.O on Thursday reported a doubling of cloud revenue to about $2 billion, from its last disclosure of $1 billion at the end of 2017.

CFO Olsavsky said Amazon Web Services’ revenue was strong, though sales cycles fluctuate depending on the timing of customers’ migration to the cloud.

“We’re growing faster than anyone” on a dollar basis, he said.

Still, that is not sufficient to cover the stepped-up investments that Amazon has planned for this year. It now is gearing up for the winter holiday shopping season. It is expanding a variety of its U.S. services globally. And it has beefed up AWS sales staff and overall marketing, which included a live-streamed concert with pop star Taylor Swift to promote its summer “Prime Day” sale.

These bets and others further afield, like its recent investments in electric and self-driving car companies, show how Amazon has been happy to forgo short-term income for long-term gains. The company for years had been known for rollercoaster profits.

Overall for the third quarter, Amazon said it expects operating income between $2.1 billion and $3.1 billion, versus $3.7 billion the year prior. Analysts were expecting $4.4 billion, according to analytics firm FactSet.

(GRAPHIC - Amazon shipping costs: tmsnrt.rs/2y7OGJN)