(Reuters) - Facebook Inc FB.O on Tuesday relieved investors by forecasting that margins would stop shrinking after 2019 as costs from scandals ease up, sending shares up despite a second-straight quarter with record-low user growth.

Chief Executive Mark Zuckerberg repeated the company’s warning that growing user interest in private messaging, video and safer content would cause costs to rise faster than revenue for “some time.” But he said he was focused on bringing them in line.

That same guidance three months ago sparked Facebook’s biggest one-day sell-off as some investors braced for dire results. The third-quarter performance and revised guidance suggested that the downward trend would be more gradual and taper off after 2019, financial analysts said.

Shares of Facebook traded up about 3 percent after updating its forecast. They reversed course several times, falling and gaining as much as 5 percent, during an hour of volatility after closing on Tuesday up 2.9 percent at $146.22.

Facebook, Amazon.com Inc AMZN.O and Google parent Alphabet Inc GOOGL.O had suffered a battering over the last month on Wall Street after leading a years-long rally. Slowing growth has been a top concern, and Facebook's weak results did not squash those fears.

“The best news was that the quarter was just not a disaster,” Ivan Feinseth, analyst at Tigress Financial Partners, told Reuters.

The company estimated revenue growth would slow in the current quarter, compared with last quarter, which could mark the worst performance since its initial public offering in 2012.

The main Facebook service and its Messenger sibling grew monthly users to 2.27 billion, up 10 percent compared with a year ago but a percentage point below both expectations and last quarter’s pace.

Zuckerberg said that Facebook’s problem is that users are gravitating toward features such as direct messaging and video viewing faster than it can find ways to place ads there while attracting clicks and not annoying users.

FILE PHOTO: Figurines are seen in front of the Facebook logo in this illustration taken March 20, 2018. REUTERS/Dado Ruvic

Adding to the challenge is that the bulk of new users are from countries including India, Indonesia and Philippines where advertisers focus more on TV, print and outdoor advertising, Facebook executives said.

Average revenue per U.S and Canadian user grew 6.7 percent in third quarter compared with the same period last year. Growth for Asian-Pacific users was 4.6 percent.

Though the factors are holding back ad prices, they also leave Facebook with significant untapped commercial opportunities with newer businesses such as WhatsApp. Still, Facebook said WhatsApp would not be a revenue driver in 2019.

A few financial analysts are concerned that the company’s operational problems are so vast that revenue growth and cost containment will not come as expected.

The company disclosed its latest gaffe on Tuesday, saying that its misclassification of user activity had led to immaterial overcounting of monthly and daily users.

More broadly, the social network’s reputation has suffered from a data breach affecting 29 million users in September and a privacy scandal involving a British political consulting firm in March.

It also has been rocked by domestic and international information warfare on its services, including WhatsApp and Instagram, and a wave of executive departures.

About 2.6 billion users interact with at least one of Facebook’s services each month, up from 2.5 billion when it released the figure for the first time last quarter to emphasize that its potential audience for advertisers is unrivaled in size.

Facebook’s spending has ballooned from licensing more engaging content such as video, and as it tries to fortify itself against fraudsters and hackers.

Zuckerberg said upcoming elections would be a test of its new systems, which he expects will be fully installed by end of 2019.

“With a community of more than 2 billion people, we will see all the good and bad that humanity can do. And we will never be perfect,” he said.

Total expenses in the third quarter surged to nearly $8 billion, up 53 percent compared with a year ago. Operating margin, which Facebook has said should fall around 35 percent, dropped 2 percentage points from last quarter, to 42 percent.

The company estimated 2018 expenses would rise 50 percent to 55 percent above last year, trimming an earlier range of up to 60 percent. It forecasts expenses will grow 40 percent to 50 percent in 2019.

Overall third-quarter revenue was $13.7 billion, up 33 percent from the same period last year and in line with expectations when accounting for currency fluctuations.

Quarterly profit of $5.1 billion, or $1.76 per share, was up 9 percent and above the average per-share estimate of $1.48.

(GRAPHIC: Facebook revenue growth losing steam - tmsnrt.rs/2CO7xgt)