Amazon topped $2 billion in quarterly profit for the first time in its history, an impressive run fueled by continued growth in Prime subscriptions, cloud computing and its nascent advertising business.

Amazon said Thursday that it earned $2.5 billion in profit for the three months ending in June, a staggering jump from the $197 million it posted in the same period last year.

It marked the third consecutive quarter that Amazon has topped $1 billion in profit, a remarkable feat for a company once known for investing so much in its business that it often lost money.

"The profitability trajectory appears to be accelerating quicker than expected," Daniel Ives, an analyst with GBH Insights, wrote in an investor note Thursday. Ives called this a "potential game changer" as Amazon continues to invest heavily in fulfillment centers, new stores and pricey content deals.

However, weaker than expected sales growth tempered the results. Amazon sales hit $52.9 billion for the quarter, a 39% increase from the same period a year earlier but slightly below Wall Street's estimates.

Amazon's cloud computing business, Amazon Web Services, remains the key profit maker. The division jumped to more than $6 billion in sales for the quarter as it continues to dominate the public cloud computing market in the face of competition from Microsoft (MSFT) and Google (GOOGL). The cloud division also boasts higher profit margins than Amazon's core retail business.

"Amazon Web Services is basically the silver bullet for them for future growth," says Dan Morgan, senior portfolio manager at Synovus Trust.

Related: Amazon made Prime indispensable - here's how

Amazon continues gaining momentum in advertising at a time when Facebook (FB) and Google, the two giants in the market, face mounting scrutiny over their data privacy practices and the prevalence of fake news and disinformation on their platforms. The company's "other" category, said to consist "primarily" of advertising services hit nearly $2.2 billion in sales for the quarter, up 132% from the same period a year prior.

And then there is Prime. While Amazon did not disclose new stats for the quarter, more than 100 million people pay for Amazon's subscription service, which includes two-day shipping and access to a growing slate of TV shows and movies. During the quarter, Amazon raised the price of a Prime membership from $99 to $119 a year.

The markets were jittery ahead Thursday after Facebook spooked investors by warning of slowing sales growth in the second half of the year as it focuses on "putting privacy first." Amazon saw its stock dip nearly 3% in trading Thursday, but it rebounded following the earnings results.

Amazon stock ticked up 3% in after hours trading.

Earlier this month, Amazon's market value topped $900 billion for the first time, putting it on the cusp of eclipsing Apple as the world's most valuable company.