Men’s Wearhouse (MW) said Tuesday it agreed to acquire smaller rival Jos. A. Bank (JOSB) for $1.8 billion, ending a months-long takeover battle between the suit sellers.

The deal, valued at $65 a share, will create the fourth largest U.S. men’s apparel retailer, with more than 1,700 domestic stores, 23,000 employees and sales of $3.5 billion.

Men’s Wearhouse expects the transaction to immediately contribute to earnings in the first full year of the merger. The transaction is expected to close by the third quarter.

Houston-based Men’s Wearhouse will finance the deal with cash plus financing from Bank of America (BAC) Merrill Lynch and J.P. Morgan Chase (JPM).

In a joint statement, Jos. A. Bank and Men’s Wearhouse said their merger will generate $100 million to $150 million in annual synergies realized over three years. Jos. A. Bank’s store banner will remain in place.

Shares of Men’s Wearhouse jumped 4.8% to $57.20 on news of the agreement. Jos. A. Bank rallied 3.9% to $64.26.

“Together, Men’s Wearhouse and Jos. A. Bank will have increased scale and breadth, and Jos. A. Ban’s strong brand and complementary business model will broaden our customer reach,” said Doug Ewert, president and chief executive Men’s Wearhouse.

As part of the deal, Jos. A. Bank has terminated its proposal to acquire Eddie Bauer. The Hampstead, Md.-based company recently announced a deal to buy Eddie Bauer for $825 million but reserved the right to scrap the offer if a superior transaction emerged.

Jos. A. Bank is also withdrawing its previously announced tender offer to purchase up to $300 million of its common stock.

Robert N. Wildrick, chairman of Jos. A. Bank, said the board has been “rigorously focused on pursuing a path for our shareholders that maximizes value creation” and “committed to pursuing a range of strategic alternatives to achieve that goal.”

Tuesday’s deal for $65 a share reflects a 56% premium over Jos. A. Bank’s share price in October, when the company began a buyout tug-of-war with Men’s Wearhouse.

The two retailers traded offers in the fall, and Men’s Wearhouse raised its own bid several times. Late last month, Jos. A. Bank rejected an offer of $63.50 a share but accepted Men’s Wearhouse’s invitation to enter formal talks. The two sides entered into a non-disclosure agreement and drafted a merger deal about a week ago.

Merrill Lynch and J.P. Morgan acted as financial advisors to Men’s Wearhouse. Goldman Sachs (GS) and Financo advised Jos. A. Bank.

Eminence Capital, a major shareholder in both retailers, praised the merger agreement and announced the withdrawal of its nominees for Jos. A. Bank’s board. The activist firm had been pressuring the companies to strike a deal.

Follow Matthew Rocco on Twitter @MatthewRocco