The deal is worth £15m a year, and comes after TalkTalk ended its ten-year relationship with the singing contest show created by Simon Cowell.
Just Eat will launch "Chef Factor", a nationwide search for real chefs to star in the TV idents that appear at the beginning and end of commercial breaks during the show.
TalkTalk’s work with The X Factor from the past three years also featured "real people". Idents encouraged fans to create user-generated music videos in 2014 and the brand built a karaoke-inspired FX Star app last year.
The new partnership will go live when series 14 of The X Factor airs in the summer. The sponsorship was negotiated by Just Eat’s media planning and buying agency, M/SIX, while Just Eat’s ad agency Karmarama will handle the creative.
Just Eat will also offer UK customers exclusive access to the show through behind-the-scenes content and ticket giveaways.
Barnaby Dawe, chief marketing officer of Just Eat, said: "It’s a great fit for both brands as we each play a key role for millions of people every weekend. Last year over 39 million people watched The X Factor, so the partnership will give the Just Eat business a fantastic opportunity to reach an even broader audience.
"We are especially pleased that we can use The X Factor sponsorship as a platform to celebrate our restaurant partners and drive orders to all of them."
The new deal follows Just Eat’s 2016 sponsorship of the official X Factor App, which was downloaded over 2.3 million times, according to ITV.
ITV opened talks at the end of last year for a new X Factor sponsor after TalkTalk chose not to renew its current three-year deal, which was reportedly worth £10 a year. ITV told agencies it was looking for £15m a year.
There could also be opportunities for product placement subject to Ofcom approval.
The X Factor remains one of ITV’s most popular entertainment shows but ratings have fallen significantly in recent years and lagged behind its BBC rival Strictly Come Dancing in the Saturday night audience battle in autumn and the run-up to Christmas.
Last year’s final, in which Matt Terry won the competition, attracted an average of 7 million viewers – down 15% year on year – its worst audience on record for a final since the show first launched in 2004.
Simon Daglish, deputy managing director, commercial, ITV, added: "The X Factor is one of the biggest shows on TV and Just Eat were a big part of the last series as sponsors of the official app. I’m delighted that they will be extending that sponsorship for the new series and joining together two brands well known for creating fantastic weekends."