Amazon’s streak of record profits has come to an end.

Amazon on Thursday reported a profit of $2.6 billion for the three months ending in June — up slightly from the year prior, but well below its record of $3.6 billion set in the first three months of this year. That ends Amazon’s streak of four consecutive quarters of record profits.

The weaker profit comes as Amazon is investing heavily in expediting deliveries. The company previously announced that it would spend $800 million during the second quarter to make free one-day shipping standard for its Prime customers, effectively halving the usual shipping window. Amazon stock was down 1.4% premarket.

Still, Amazon posted a profit 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, which is expanding rapidly in NC, to provide technical training for workers

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.

US Treasury Secretary: Amazon ‘destroyed the retail industry across the United States’

“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.

Amazon: 2-day Prime event tops Black Friday-Cyber Monday sales

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.

Feds target ‘Big Tech’ with antitrust probe to ‘ensure Americans have access to free markets’

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.