Alphabet, the parent company of Google, reported $39.3 billion in revenue for the final three months of 2018, an increase of 22% from the same period a year earlier.

The growth was fueled in large part by Google’s advertising business. But the company also said it is now paying more to support its advertising business.

Alphabet said its traffic and acquisition cost — the money it pays to companies to run its ads and services — was $7.4 billion during the quarter, up from $6.5 billion a year ago. Its operating margin declined to 21%.

Analysis: With more than $100B in cash, it’s time for Google to pay a dividend

Alphabet swung to a profit of $8.9 billion, up from a $3 billion loss in the same period a year ago due to the effects of a new federal tax law.

Alphabet’s earnings per share of $12.77 beat Wall Street expectations of $10.86 per share, according to analysts polled by FactSet.

But Alphabet also spent more on research and development and other expenses during the quarter, as it works to expand its cloud computing business and its long-term bets such as self-driving cars.

Alphabet’s stock price dropped roughly 3 percent despite the beat in after-market trading Monday. Analysts attributed the decline to Alphabet’s increased investment in its cloud business, YouTube and other areas it hopes to grow.

Executives noted the company’s focus on expanding the cloud business during a call with analysts Monday, as it races to compete against rivals Amazon and Microsoft in the growing industry. Amazon currently leads in that market, followed by Microsoft and Google in a somewhat more distant third place.

Late last year, Google brought in former Oracle Corp. executive Thomas Kurian to lead its cloud business into what it hopes to be a rapid growth stage. Cloud bets are likely to start paying off in the coming years, said Wedbush Securities analyst Daniel Ives. And it would be short-sighted to count Google out, though Amazon and Microsoft’s businesses are larger.

“I think Microsoft and Amazon need to keep one eye open with Google,” he said.

Google revenues from its “other” category, which includes what it pulls in from cloud services and hardware, climbed more than 30 percent to $6.5 billion in the fourth quarter.

Alphabet’s Other Bets business, which includes its self-driving car company Waymo and health-tech venture Verily, saw revenue rise to $154 million, up from $131 million in the year-ago period. But operating losses also ballooned to $1.3 billion, a 78 percent increase since the year-earlier quarter.

Alphabet shares have climbed 9 percent since the beginning of the year, while the Standard & Poor’s 500 index has risen roughly 9 percent. In the final minutes of trading on Monday, shares hit $1,141.42, a rise of 2 percent in the last 12 months.