Online food ordering company Takeaway.com has won the battle for the UK-listed Just Eat with a £5.9bn all-share offer.
The deal will create one of the world's largest meal delivery companies.
Dutch giant Takeaway.com was bidding against tech investment firm Prosus.
The merged company, which will be led by Takeaway chief executive Jitse Groen, will have its headquarters in Amsterdam and a listing in London.
The joint group will bring together businesses that process 360 million annual orders worth €7.3bn (£6.6bn).
"I am thrilled," said Mr Groen. "Just Eat Takeaway.com is a dream combination and I am very much looking forward to leading the company for many years to come."
Takeaway said that 80.4% of Just Eat shareholders had agreed to its latest all-share offer, passing a 50% threshold needed to make the offer unconditional.
The bid was worth 889 pence per share at the latest close, trumping a rival bid of 800 pence per share in cash from Prosus.
The fight to buy Just Eat began in August, when Takeaway struck a management-backed deal to buy Just Eat that would see Takeaway holding a 48% stake in the combined firm.
That plan was upended when Prosus laid down the first of three unsolicited rival bids in October. All were rejected as inadequate by Just Eat managers.
Prosus argued Takeaway was underestimating the investment needed to fend off rivals such as Uber Eats and Amazon.com.
Mr Groen responded that food delivery was a low-margin business, and investments should focus on becoming the dominant ordering platform.
The combined firm will have 23 subsidiaries, mostly in Europe but also in Canada, Australia and Latin America.
Just Eat was founded by a group of five Danish entrepreneurs in 2000 and launched a year later. It employs 3,600 staff globally.
As well as the Just Eat brand in Europe, it trades as Skip The Dishes in Canada, iFood in Mexico and Brazil, and Menulog in Australia and New Zealand.
Just Eat is listed on the London Stock Exchange and is a member of the FTSE 100 share index.