NEW YORK (AP) -- Amazon's ramped up spending on speedier delivery for its Prime customers helped to accelerate its sales in the second quarter.
But it also crimped its profits.
The Seattle-based company reported Thursday that its sales soared a better-than-expected 20% in the quarter.
But it posted a profit for the three-month period ended June 30 of $2.62 billion, or $5.22 per share. Analysts had expected earnings per share of $5.56 per share, according to FactSet. A year ago it earned $2.53 billion, or $5.07 per share.
Amazon's guidance for operating income for the current quarter was also well below what Wall Street expected. Its stock slipped about 1.7% to $1,941 in extended trading following the earnings report.
Executives told analysts that the company spent more than the $800 million it had planned to spend in the second quarter to move to one-day delivery from two-day delivery for its Prime members, who pay $119 a year. The service is now available on more than 10 million items.
"Customers are responding to Prime's move to one-day delivery — we've received a lot of positive feedback and seen accelerating sales growth," said Jeff Bezos, Amazon founder and CEO in a statement.
The move comes as Amazon faces increasing competition from the likes of Walmart and Target, both of which are speeding up deliveries. Walmart is offering next-day delivery for shoppers in Phoenix, Arizona, Las Vegas and Southern California. It plans to roll out the service to 75% of the U.S. population by year end.
Amazon's spending on next-day Prime delivery "is an example of short-term pain for long-term gain, and is a necessary strategy to compete with brick-and-mortar's speed advantage to the customer," said Moody's Amazon analyst Charlie O'Shea.
At the same time, Amazon, along with Facebook, Google and Apple, is feeling the heat from government investigations into Big Tech's market dominance.
The Federal Trade Commission has been conducting an antitrust probe of the companies, and the Justice Department announced Tuesday it is opening a sweeping antitrust investigation of major tech companies and whether their platforms have hurt competition and stifled innovation.
The department's announcement didn't name any companies, but it mentions online retail services as an area of "widespread concern."
The Trump administration, however, did name Amazon on Wednesday. Treasury Secretary Steven Mnuchin told CNBC, "I think if you look at Amazon, although there are certain benefits to it, they've destroyed the retail industry across the United States so there's no question they've limited competition."
Amazon's business remains unscathed so far. The online leader said net sales rose to $63.4 billion for the second quarter. That's higher than the $62.5 billion forecast by analysts.
The company has buttressed its profits by expanding into businesses beyond selling goods online. Revenue at its cloud computing business, which powers the video-streaming service Netflix, digital scrapbooking site Pinterest and many other companies, rose 37% from a year ago.
Amazon's fast-growing advertising business has also become a big money maker, selling ads to companies that want their products to show up first when shoppers search on the site.
Amazon doesn't say exactly how much its ad business makes, but lists it as part of its "other" revenue, which rose 37% from a year ago.
The company said that its operating income would be in the range of $2.1 billion to $3.1 billion for the current quarter. Analysts had been looking for $4.39 billion, according to FactSet.
Amazon also forecast that net sales will be between $66 billion and $70 billion for the current quarter. Analysts forecast $67.28 billion, according to FactSet.