Leeds are 19th in the Premier League table and are without a win in 10 matches.
Defeat in the weekend’s relegation six-pointer with Everton saw the club fall into the bottom three and Gracia will now be tasked with keeping the Elland Road club up over the final 15 games of the campaign.
Leeds announced the news in a statement on their official website, saying: “Leeds United are delighted to announce the club have agreed terms with Javi Gracia to become men’s first team head coach, subject to obtaining a work permit.
“The experienced 52-year-old has agreed a flexible contract at Elland Road.”
The Spaniard was in charge of Watford between January 2018 and September 2019. During that time he led the Hornets to safety and reached the FA Cup final, but was sacked following a poor start to the following season.
The 52-year-old has since taken jobs at Valencia and Qatari club Al Sadd.
Under-21s boss Michael Skubala had been placed in temporary charge at Elland Road, overseeing two Premier League games in the space of five days against Manchester United – a 2-2 draw and a 2-0 home defeat – and a 1-0 loss at Everton.
Leeds’ hunt for Marsch’s replacement had met with several setbacks. Talks with former Ajax boss Alfred Schreuder broke down, Rayo Vallecano blocked a move for Andoni Iraola and Arne Slot opted to stay at Feyenoord after he was approached.
Carlos Corberan signed a new contract with West Brom, while it was reported in Argentina that former River Plate boss Marcel Gallardo ruled himself out of the running.
Leeds, two points from safety, are winless in their last 10 league matches. Their last top-flight victory was on November 5 and they will go bottom if they lose to Southampton.
Leeds added: “The club hope Gracia’s first game in charge of the Whites will be Saturday’s Premier League clash against Southampton at Elland Road, subject to obtaining the necessary work permissions.”
Additional reporting by PA