Dollar General Corp. offered $9.7 billion for Family Dollar Stores Inc., setting off a bidding war for a company that had agreed to an $8.5 billion takeover by Dollar Tree Inc. last month.

Dollar General plans to pay $78.50 a share in cash, compared with Dollar Tree’s bid of $74.50 a share in cash and stock, according to a statement today. The deal will generate $550 million to $600 million in cost savings annually three years after its completion, Dollar General said.

“We look forward to expeditiously entering into constructive discussions with Family Dollar in order to sign a definitive merger agreement,” Chief Executive Officer Rick Dreiling said in the statement.

Dollar General, based in Goodlettsville, Tennessee, is fighting to keep its perch at the top of the dollar-store industry. A merger between its two rivals would have created a new market leader, escalating competition at a time when Wal- Mart Stores Inc. also is looming with new smaller-format stores.

The Dollar General chain is more similar to Family Dollar’s, meaning it may be able to extract bigger benefits from a takeover than Dollar Tree, according to Poonam Goyal, a senior retail analyst for Bloomberg Intelligence.

While Dollar Tree caters to middle-class consumers and sells most items for $1, the other two dollar chains both focus on low-income shoppers and offer more food at various price points. If combined,Dollar General and Family Dollar would have about $28 billion in annual revenue, according to data compiled by Bloomberg.

Family Dollar shares rose as much as 6.2 percent to $80.76 in early trading in New York, while Dollar General surged 12 percent to $64.25. Dollar Tree fell 1.9 percent to $54.57.

Today’s offer is 5.4 percent higher Dollar Tree’s bid and 29 percent above Family Dollar’s stock price on the last trading day before the earlier deal was announced on July 28.

Family Dollar’s shares have traded above the Dollar Tree offer over the past three weeks, signaling that investors were expecting a higher bid. Bloomberg News also reported on Aug. 5 that Dollar General was weighing an offer after earlier passing on making one.

Randy Guiler, a spokesman for Chesapeake, Virginia-based Dollar Tree, declined to comment on Dollar General’s offer or say whether his company planned to continue pursuing Family Dollar. Bryn Winburn, a spokeswoman for Matthews, North Carolina-based Family Dollar, didn’t respond to requests for comment.

The battle for Family Dollar began after activist investors Carl Icahn and Nelson Peltz took large stakes in the retailer and then pushed for a sale. Icahn still owns about 3.6 percent of the shares, while Peltz’s Trian Fund Management LP has a 7.3 percent stake.

The proposed combination of Dollar General and Family Dollar would add to earnings by a low double-digit percentage in the first full year, excluding implementation and transaction costs, Dollar General said. The deal’s estimated expenses would include a $305 million termination fee payable to Dollar Tree.

The combined company also would be prepared to sell as many as 700 stores to gain antitrust approval, according to the statement. A combined company would have almost 20,000 locations, making it the nation’s largest retail chain in terms of locations. Wal-Mart, which generates far more sales per store, is the biggest retailer in revenue.

Dollar General, which is being advised by Goldman Sachs Group Inc., is “confident it can quickly and effectively address any potential antitrust issues.”

To help see the deal through, Dreiling will remain in the CEO and chairman roles through May 2016. Beyond that date, he’d be willing to remain chairman if asked by the board and elected by shareholders, according to the statement. He had previously said he would retire this coming May.

Family Dollar and Dollar Tree are the No. 2 and No. 3 dollar-store chains by number of outlets, while Dollar General is the largest. Sales at the chains, which specialize in cheap household goods, have slowed since the U.S. economy began improving and consumers became less focused on finding bargains. Still, they’re outpacing the growth of bigger discount retailers, including Wal-Mart and Target Corp.

Wal-Mart is spending $600 million this year to add more Neighborhood Market and Express stores, aiming to get a larger piece of the neighborhood discount market. The smaller-format outlets have outperformed its supercenters and Sam’s Club locations.

--With assistance from Robert Valpuesta in London.