(Reuters) - Facebook Inc reported better-than-expected profit on Wednesday, showing that digital advertisers were still flocking to spend money on the service in order to reach customers even after a series of high profile embarrassments for the world’s largest online social media network.

Investors have worried that Facebook’s pledge to invest heavily to improve its privacy and security standards would blunt the company’s growth, but its fourth-quarter results appeared to soothe those concerns, sending its stock price up more than 11 percent after hours.

“The worst is over for this social media giant,” said Haris Anwar, an analyst at Investing.com: “Its ad business and user engagement haven’t been affected despite all the negative blows of the past year.”

The company has struggled with scandals over improperly shared customer data and propaganda on its service that tarnished its image and made it the target of political scrutiny across the globe last year.

That has not significantly harmed advertising, where Facebook makes the vast majority of its revenue. Although ad prices have fallen, Facebook has been showing more ads, particularly on its Instagram app, as it finds users crave daily visual updates from friends, family and celebrities enough to sift past commercials and photo ads every few seconds.

The number of ad impressions across Facebook’s system accelerated each quarter last year compared to the prior year’s quarters, as Facebook moved more aggressively in generating revenue from Instagram after its initial caution on using that strategy, for fear of turning off users.

Total fourth-quarter revenue rose 30 percent to $16.9 billion from $12.97 billion, its slowest quarterly revenue growth in more than six years as a public company. It was, however, above analysts’ average estimate of $16.4 billion.

Net income rose to $6.88 billion, or $2.38 per share, up from $4.27 billion, or $1.44 per share, a year earlier. Analysts on average had expected earnings of $2.19 per share, according to IBES data from Refinitiv.

GRAPHIC-Facebook revenue: tmsnrt.rs/2HI8IC9

Facebook logo is seen at a start-up companies gathering at Paris' Station F in Paris, France, January 17, 2017. REUTERS/Philippe Wojazer

“These numbers are actually some of the most reassuring in its short history,” said George Salmon, an analyst at Hargreaves Lansdown.

“Not only are login trends in Europe improving after a stagnant couple of quarters, the group has beaten expectations on revenue and profit. These results will go a long way towards regaining the trust of Wall Street.”

Facebook shares rose more than 11 percent to $168.20 after the bell. They closed up 4.3 percent in regular trading.

MORE STORIES, MORE MESSAGES

Facebook managed to increase sales despite a 2 percent drop in the average price per ad in the fourth quarter compared to a year ago, as its ad views came from less lucrative areas such as Instagram’s Stories feature and developing markets.

It was the first price decline since the final quarter of 2012, when Facebook lowered prices to stoke demand in emerging markets, but the company appeared to make up for the drop in overall sales volume.

Executives said on a conference call after reporting earnings that they would focus this year on finding new ways to push ads.

“People are creating more Stories and sending more messages, which means these are emerging areas of opportunity for marketers,” said Chief Operating Officer Sheryl Sandberg.

The higher sales figures helped offset total expenses, which surged in the fourth quarter to $9.1 billion, up 62 percent compared with a year ago. The operating margin fell to 46 percent in the fourth quarter from 57 percent a year ago.

Facebook’s shares have lost a third of their value since July, when it first warned about slowing growth in revenue and operating margin. Despite Wednesday’s bump, its share price remains near its lowest point in two years.

Facebook said on its conference call that total revenue growth rate this quarter would decelerate by mid-single digits, excluding currency fluctuations, compared to the fourth quarter, and continue to slow throughout the year.

It said it continued to expect 2019 total expenses to grow about 40 percent to 50 percent compared with 2018.

GRAPHIC-Facebook costs: tmsnrt.rs/2HD7isF

Despite its privacy issues, Facebook managed to gain some new users, particularly in India, Indonesia and the Philippines. Facebook said more than 2.7 billion users interact with at least one of its apps each month, up from 2.6 billion last quarter.

Monthly and daily users of the main Facebook app compared to last quarter were up 2.2 percent to 2.32 billion and 2.0 percent to 1.52 billion, respectively.

Estimates were for 2.3 billion monthly users and 1.5 billion daily users, according to Refinitiv averages.

Facebook shares continue to trade at a discount to peers. Shares entering Wednesday of No. 1 online ad seller Alphabet Inc, for instance, were priced at 22.4 times expected earnings over the next 12 months, compared to 19.3 times for Facebook.