New York (CNN Business) Amazon's streak of record profits has come to an end.

Amazon AMZN 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 impressive streak of four consecutive quarters of record profits.

The weaker-than-expected 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.

On a conference call with analysts after the report Thursday, Amazon CFO Brian Olsavsky said the actual cost of speeding up shipping ended up being "a little bit higher than that number." The company grappled with "transition costs in our warehouses" as well as "costs from buying more inventory and moving around in network to be closer to customers."

"It does create a shock to the system," Olsavsky said on the call. "We are working through that now."

Read More