SEATTLE — Alphabet, the parent company of Google, said on Monday that its quarterly profit fell 23 percent after it sharply increased spending, in a rare financial stumble by the tech giant.

Alphabet reported that its revenue rose 20 percent to $40.5 billion for the third quarter, but that profit dropped to $7.07 billion. Profit, which missed Wall Street forecasts, was hurt by rising costs for research and development and marketing, the company said.

In after-hours trading, Alphabet’s stock declined 2 percent.

The performance demonstrated the challenges of trying to maintain growth at the company and showed how Google must invest to keep that up. While advertising, rooted in the dominance of Google’s internet search engine, has sustained Alphabet’s bottom line in recent years, that business isn’t growing as fast as it once did. Google is also facing new competition for marketing dollars from Amazon and others.

Alphabet faces other challenges. Google is squarely in the sights of regulators and politicians who want to take down a monopoly. Its employees have been unhappy with management, political conservatives accuse the company of bias and YouTube has been under attack for spreading misinformation.