Gatland returns as Wales coach in place of Pivac
Wales slipped to a ninth defeat in 12 tests this year when they blew a 21-point lead in the 39-34 loss to Australia in their final match of the Autumn series, which also included defeats by New Zealand and Georgia.
Gatland, who formerly coached Wales over a 12-year period, will return before Christmas and take charge for the 2023 Six Nations and next year's World Cup in France.
"This is one of the toughest calls to make in sport, but the review process has reached its conclusion and we acted quickly and efficiently in the very best interests of our national team," WRU CEO Steve Phillips said.
"Ultimately we're in the results business and we have agreed with Wayne that the current trajectory for Wales is not where we want it to be and we thank him sincerely for his time, enthusiasm, diligence and effort, which is unquestioned, as head coach over the last three years."
Gatland leaves Super Rugby side the Chiefs to take up his new role. He completed his first Six Nations clean sweep in his debut season with Wales in 2008 and repeated the feat in 2012.
The New Zealander also guided the Welsh to victory in the 2019 Six Nations and three World Cups, reaching the semi-finals in 2011 and 2019. He also took Wales to the top of the world rankings.
"I'm very much looking forward to returning to coach Wales," said Gatland.
"This is an opportunity to achieve something with a talented group of players in a country so passionate about rugby. A country which made my family and I so welcome, when we first arrived 15 years ago, and all the time we were there.
"Our immediate priority is the 2023 Six Nations and next year's World Cup."
Pivac, who took over from Gatland in 2019, said he was disappointed but understood the decision.
"It was a speedy review process post-Autumn Nations Series as time is of the essence with the Six Nations fast approaching," the New Zealander said.
"Unfortunately, the results or performances this year were not all as we hoped. As a group we all take responsibility for that, but me in particular as head coach.
"We've played some really good rugby at times, but needed to do that more consistently. However, I know there's a strong foundation for the squad to progress to great things in the future."