The competition has taken a toll on Fitbit. The company had $1.5 billion in revenue in 2018, down 6 percent from the year before, squeezing out a net profit of $48 million. In July, Fitbit lowered its guidance for the rest of the year after announcing disappointing sales results for its Versa Lite device, which was intended to compete with the broader capabilities of the Apple Watch.

Google is dipping into its $121 billion cash pile to acquire Fitbit and expand its lineup of hardware products, which already includes smartphones, tablets, laptops and smart speakers. In a statement on Friday, Fitbit said Google was paying $7.35 per share in cash, or about $2.1 billion. Fitbit shares surged 15 percent on the news. The deal is expected to close in 2020, although no specific date was provided.

Google has pushed aggressively into hardware since 2016, when it introduced smartphones under its own Pixel brand. But it has not gained significant traction. The smartphones are generally well reviewed, but they are still an afterthought to Apple and Samsung. Google also sells a range of other home devices, including digital thermostats and smoke detectors that came with the 2014 acquisition of Nest.

Watches, a segment dominated by Apple, are a hole in Google’s product lineup. By acquiring Fitbit, Google acquires a recognized brand and the closest competitor to Apple in the market, said financial analysts.

In a note to clients, Michael Pachter, an analyst at Wedbush Securities, said “buying Fitbit makes more sense than trying to build yet another competitor to Fitbit.” However, he added that this was another example of Google “tilting at windmills” because the company was “uniformly bad at consumer products in our view, and appears to us to be intent on spending whatever it takes to prove our view wrong.”

Because Google has been the subject of antitrust investigations in Europe and the United States, regulatory concerns hang over the deal. In a filing with the Securities and Exchange Commission, the two companies said Google would pay Fitbit a $250 million breakup fee to Fitbit if the deal fails to secure antitrust approval. The Justice Department and the Federal Trade Commission declined to comment on the deal.

So far, much of the antitrust scrutiny directed at Google has focused on the search and advertising side of its business. How Google presents its search results could be subject to antitrust laws because it handles more than 90 percent of searches worldwide, according to some estimates.