Amazon.com Inc. (NASDAQ:AMZN) reported in its third consecutive record profit and its most profitable quarter to date on Thursday. Overall, Amazon posted a profit of 857 million, or $1.78 a share, for the second quarter. This compared with a profit of $92 million, or 19 cents a share, a year earlier. Amazon’s revenue jumped 31 percent, rising to $30.4 billion from $23.19 billion. Analysts expected $1.11 a share on revenue of $28 billion to $30.5 billion.

After a lengthy period of heavy investments and quarterly losses, Amazon is moving toward consistent profitability. The results nearly doubled its prior high-water mark. It was also the company’s fifth straight quarter in the black. The company also more than doubled its operating margin. Amazon’s operating profit margin was 4.2 percent for the quarter, compared with 2 percent a year earlier. Amazon boosted its employment 9.6 percent, compared with the first quarter.

Its Amazon Web Services cloud computing unit reported a 58 percent gain over the year ago quarter. The division sells access to computing power over the internet and has become the go-to provider for startups, many government agencies and large corporations. AWS revenue in the quarter jumped to $2.89 billion, from $1.82 billion a year earlier.

The $99-per-year Prime unlimited shipping membership has proven to be a big driver of online sales. The program also has exclusive streaming television shows and music, as well as a one-hour delivery service in a number of cities. The company recently rolled out month-by-month subscription offerings for both Prime and its streaming video service.

Shipping costs have accelerated more quickly than sales in recent quarters. For the second quarter, Amazon reported a 44 percent increase in shipping expenses, rising to $3.36 billion. Shipping expenses jumped 42 percent in first three months of this year and 37 percent in last year’s holiday quarter. To contain those costs, Amazon is investing in planes and branded truck trailers to carry goods and searching for new ways to take over the expensive final leg of a package’s delivery.

Amazon issued a cheery outlook for the coming quarter. It forecast third quarter sales of between $31 billion and $33.5 billion, compared with analysts’ views of $31.63 billion. The company plans to add 18 new warehouses in the current quarter compared with six a year earlier.

Get Analysts' Upgrades and Downgrades Daily - Enter your email address below to receive a concise daily summary of analysts' upgrades, downgrades and new coverage with MarketBeat.com's FREE daily email newsletter.