Leeds fans issued a vote of no confidence in Gracia after a 4-1 defeat to Bournemouth on Sunday left them outside the relegation zone only on goal difference.
Gracia replaced Jesse Marsch in February but won only three of his twelve matches in charge.
A club statement read: “Leeds can confirm Javi Gracia will leave the club after 12 games in charge.
“Zigor Aranalde, Mikel Antia and Juan Solla, who joined alongside Gracia, will also leave the club.
“We thank Javi and his team for their efforts under difficult circumstances.
“The remaining four games of the season will be overseen by experienced head coach Sam Allardyce.”
Allardyce has four games to save Leeds from going down.
“I know it (Leeds) is in a lot of trouble,” Allardyce told talkSPORT.
“I have seen a lot of trouble before and – I could have done a little bit more time, but four games – hopefully we can make a difference and keep this fabulous club in the Premier League.”
Allardyce added:“(I was) shocked (to get the opportunity), I never thought at this stage of the season there would be jobs offered.
“When the phone popped up with a name that I knew pretty well, I knew who it was straight away, so it took me about two seconds to say yes.”
Allardyce's first game will be against Manchester City this weekend followed by Newcastle United, West Ham and Tottenham Hotspurs.
“Obviously they ae very difficult games, Man City, Newcastle, West Ham and Spurs,” Allardyce said.
“You can all point out where the easiest fixture might be and of course, there are no easy fixtures in the Premier League, but we can only go and do what we can try and achieve.”