The New Zealander, a former coach of the Fiji national side, won the Guinness Pro12 trophy with the Welsh side Scarlets in 2017.
"In Wayne Pivac, we have secured the best man for the job and we have done so rigorously and decisively to the collective benefit of all involved in Welsh rugby," Welsh Rugby Union chief executive Martyn Phillips said at a news conference.
Pivac, who has been coaching for more than 20 years with spells with Takapuna, North Harbour, Northland and Auckland, said he was relishing the challenge.
"It's both a huge honour and a privilege to have been asked to be the next Wales coach," 55-year-old said.
"I know I'm following in the footsteps of someone who is held in extremely high regard, not only by the Welsh public, but also by the players who have played under him.
"I will be doing my best to protect the legacy which Warren Gatland, with the help of those players, will inevitably leave behind."
Gatland won the six-nations championship in 2008 and 2012, becoming the longest serving and most successful coach in the history of the Welsh game, with 52 wins in 105 matches during a 12-year stint in charge.