Yahoo Inc. (YHOO) posted higher quarterly profits on Tuesday, boosted by investment gains and demand for online advertising, but revenue fell short of analysts' average target, pushing the company's shares down almost 9 percent.

The Sunnyvale, Calif.-based online media company's second-quarter net profit was $754.7 million, or 51 cents a share including an investment gain of 38 cents a share, compared with its year-ago profit of $112.5 million, or 8 cents. Excluding the gain, its profit would have been 13 cents a share.

Total revenue for the quarter was $1.25 billion, up 51 percent from a year earlier. Revenue, excluding marketing fees Yahoo pays to site owners that carry its search ads, was $875 million, compared with $609 million a year ago.

Analysts' average targets had called for earnings of 13 cents per share on revenue — excluding the ad fees known as traffic acquisition costs — of $881.8 million.

Shares of Yahoo fell to $34.44 on Inet after the company reported its results. In regular trade on Nasdaq, the stock rose $1.15, or 3.1 percent, to close at $37.73.

Mark Mahaney, an analyst at Citigroup Smith Barney, said Yahoo shares took a beating in after-hours trading as the results only matched but did not exceed investor expectations.

"The stock has had a big run-up," Mahaney said. "People were talking about a big upside and this was an in-line quarter."