Sales for Amazon Web Services, the company's cloud computing business, rose to $1.82 billion, up 81 percent from a year earlier. Its operating income in the segment rose to $391 million, more than quadrupling from $77 million.
Read MoreAmazon refunds users for eBook antitrust settlement
Still, the key business accounted for only about 8 percent of Amazon's revenue in the quarter. On the company's conference call, CFO Brian Olsavsky said AWS is now in 11 regions and will soon come to India, where the company has ramped up its investment.
Revenue in North America, Amazon's largest segment, rose 26 percent year over year to $13.79 billion. However, the company's international sales grew only 3 percent.
Amazon said it expected net sales of $23.5 billion to $25.5 billion in the third quarter. It projects between a $480 million loss and a $70 million income.
On July 15, the company held its first "Amazon Prime Day" in which it attempted to recreate a Black Friday savings experience in the summer months. Amazon's third-party U.S. same-store sales for that day were about 80 percent ahead of where they were a year earlier by noon, according to e-commerce sales tracker ChannelAdvisor.
Olsavsky said Amazon was "thrilled" by Prime Day.
Read MoreJet v. Amazon: Here is the price war winner so far
—CNBC's Matthew Belvedere, Karma Allen and Zack Guzman contributed to this report.