(Reuters) — Alphabet’s fourth-quarter revenue and profit beat Wall Street’s expectations on Monday but sharply higher spending, as it added data centers and marketed its services heavily during the holidays, worried investors.

The company’s shares, which have risen almost 17 percent over the past six weeks, fell 2.3 percent to $1,114.60 in after-hours trading.

Partly because of the higher spending, Alphabet reported an operating margin of 21 percent in the fourth quarter, down from 24 percent a year ago.

Facebook’s better-then-expected fourth-quarter results last week had lifted expectations for Alphabet as they suggested that concerns about a global economic slowdown may be overblown.

Alphabet’s fourth quarter revenue rose 22 percent from a year ago to $39.28 billion, compared to the average expectation of $38.93 billion among analysts tracked by Refinitiv. About 83 percent of the revenue came from Google’s ad system.

Alphabet had $31.07 billion in total fourth-quarter costs and expenses, up 26 percent from last year. Capital expenditures rose 64 percent compared to last year, up to $7.08 billion.

A run-up in spending has reflected Google’s efforts to boost staffing on its cloud computing division, promote its consumer devices and YouTube subscription packages and acquire office buildings in Silicon Valley and New York.

Quarterly profit was $8.95 billion, or $12.77 per share, compared with a $3 billion loss a year ago. That compared to analyst estimates of $7.69 billion, or $10.87 per share.

The loss last year related to a one-time charge from new U.S. tax rules, while earnings since then have benefited from new rules about valuing Alphabet’s dozens of investments in external startups. Fourth-quarter earnings also benefited from a $1.3 billion unrealized gain related to a non-marketable debt, Alphabet said.