Amazon shares swung higher after the retail giant posted its fifth-straight period of profitability, and handily beat Wall Street's forecasts.
The online retailer reported earnings per share of $1.78 adjusted, easily sweeping past expectations for $1.11, according to a Thomson Reuters consensus estimate. Revenue came in at $30.4 billion, also beating forecasts of $29.55 billion.
That compared with net income of $92 million, or 19 cents per diluted share, in second quarter 2015.
The company's shares initially dipped following its announcement, but then inflected higher. Amazon stock is up more than 40 percent over the past year.
"Obviously this has been an incredibly strong stock since February or March so the bar is very high here," said Edward Yruma, an analyst at KeyBanc Capital Markets.
Investors have been keeping a close eye on Amazon's profits, with the second quarter marking its fifth-straight period of profitability. The company has invested to lower delivery costs and increase online media offerings to its members.
Indeed, the company said in a conference call with investors it would be doubling its content spend year-over-year in the second half of 2016, tripling its Amazon Originals content, considered a "beloved" perk of Prime. On top of that, it's experimenting with its first international location of Amazon Fresh in London, and has seen Amazon's Echo used to access Prime Music, executives said on the call.
Its operating income was $1.3 billion in the second quarter, compared with $464 million in second quarter 2015. Analysts had been expecting operating income of $903.1 million, according to StreetAccount. The company posted an operating margin of 4.2 percent, compared with 2 percent in the prior-year quarter.
"Our big call out is the strong profitability of the North American retail business. At 6.6 percent [margins], you can't make the argument that this isn't a profitable business anymore," Yruma said.
Sales from Amazon Web Services (AWS), its industry-leading cloud business, were $2.89 billion. The Street was expecting $2.83 billion.
Amazon's report comes on the heels of its best-ever day of sales, Prime Day. Though it wasn't reflected in Thursday's numbers, commentary on those loyal, valuable members was key as Wall Street digested results from the company's core retail business.
"This is a very impressive quarter for Amazon on multiple fronts," stated Moody's lead retail analyst Charlie O'Shea said in a statement. "This is particularly impressive as we believe there was likely delayed shopping/spending by Amazon's key Prime members in anticipation of the Prime Day deals, especially where purchases of discretionary items are concerned."
For the third quarter, Amazon said it expects net sales to be between $31 billion and $33.5 billion. That compares with Wall Street's forecast of $31.63 billion. Despite a Prime Day boost, the third quarter will see a lot of investment in opening new fulfillment centers ahead of the holidays, executives said on the conference call.
CNBC's Anita Balakrishnan contributed to this report.