Former Real midfielder Zidane, 46, who left in May after leading the club to a third straight Champions League trophy, has agreed to take over until 2022, the club announced.
Real are currently third in La Liga, 12 points behind leaders Barcelona.
Solari was sacked after a 4-1 win over Real Valladolid on Sunday – which followed a shock Champions League exit to Ajax.
The Frenchman replaces Santiago Solari, who was in charge for less than five months.
The defeat by Ajax followed two consecutive losses to Barcelona in El Clasico – a 1-0 reverse in La Liga and a 4-1 aggregate defeat in the Copa del Rey.
That 4-1 home defeat and 5-3 aggregate loss to the Dutch side was the final straw for Real president Florentino Perez.
Zidane stepped down following the Champions League final victory over Liverpool, and Julen Lopetegui was hired as his successor just before the World Cup where he had been due to lead Spain, who promptly sacked him.
Four and a half months later it was Real’s turn to fire him.
Reserve-team boss Solari came in as caretaker before being given a contract to 2021 on 13 November.
“Real Madrid thanks Santiago Solari for his work done and the commitment and loyalty he has shown to what is his home,” the club said.
It added the former player had been offered another role with the club.