Barnes & Noble has been acquired by the hedge fund Elliott Advisors for $638 million, a move that has momentarily calmed fears among publishers and agents that the largest bookstore chain in the United States might collapse after one of the most tumultuous periods in its history.

The sale was announced Friday morning after months of speculation over the future of Barnes & Noble. The acquisition follows Elliott’s purchase of the British bookstore chain Waterstones in June 2018. James Daunt, the chief executive of Waterstones, will also act as Barnes & Noble’s C.E.O. and will be based in New York.

It marks a surprising new chapter in the 40-plus-year history of Barnes & Noble, which evolved from a single Manhattan bookstore in 1971 and grew into a national fleet of superstores. In the 1990s, Barnes & Noble was often vilified as a greedy corporate giant that slashed book prices to lows that its competitors could not match and helped put struggling independent booksellers out of business across the United States.

But in recent years, Barnes & Noble has been decimated by the strength of online booksellers like Amazon and struggled to make a profit. The company has closed more than 150 stores in the last decade or so, leaving it with 627.