SAN FRANCISCO (MarketWatch) — Amazon.com Inc. reported a 16% gain in third-quarter earnings on Thursday as sales for the period beat Wall Street’s targets.

However, the online-retail giant saw its shares clipped by nearly 4% after hours, with its margin forecast for the fourth quarter missing analysts’ forecasts.

Hot Stocks: EBay, Netflix Boost Tech

Amazon AMZN, +0.12% has been on a strong run of late, surging more than 35% since the last quarterly report and closing up almost 4% at $164.97 in the regular session Thursday. Read more on Amazon shares in Ratings Game.

“Amazon’s stock works when they beat on revenue and don’t surprise on the margins,” said Sandeep Aggarwal of Caris & Co.

For the period ended Sept. 30, Amazon reported net income of $231 million, or 51 cents a share, compared with net income of $199 million or 45 cents a share for the same period last year.

Revenue jumped 39% to $7.56 billion. Free cash flow declined by 5% to $1.83 billion.

Analysts were expecting earnings of 48 cents a share on revenue of $7.37 billion, according to consensus forecasts from FactSet Research.

Operating income came in at $268 million; analysts had been expecting $289.5 million. This brought operating margins to 3.5% for the period — within the range of 3% to 4% that Amazon had estimated in July.

For the third quarter, total operating expenses grew by 40%. Part of that was increased marketing costs, and part was the company’s increased spending on infrastructure. CFO Tom Szkutak said the company has opened ten new distribution centers so far this year, with three more slated to come online in the coming weeks.

“They’re getting less leverage,” said Colin Gillis of BGC Capital. “Typically, you want to see operating income growing faster for a company their size.”

The third quarter was driven primarily by sales growth of electronics and general merchandise, which have overtaken media products as Amazon’s largest revenue contributor. Sales in this category surged 68% to 3.97 billion.

Media sales grew by 14% to $3.35 billion for the quarter.

As usual, Amazon gave no details about its Kindle e-book business. The company has brought down the price significantly on the e-reader devices — with its cheapest Wi-Fi-only device selling for just $139. Marketing expenses rose during the third quarter as a percent of revenue, partly due to increased support for the device.

For the December quarter, Amazon said it expects revenue to come in the range of $12 billion to $13.3 billion. Analysts were looking for about $12.3 billion in revenues, according to FactSet estimates.

Operating margin for the period is expected to come in the range of 3% to 4.2%. Wall Street had been expecting 5%, on average, for the quarter.