Gatland is stepping down after the 2019 World Cup in Japan and will be replaced by his fellow New Zealander.
Welsh Rugby Union (WRU) chairman Gareth Davies and chief executive Martyn Phillips announced the appointment at a news conference on Monday.
Pivac, 55, said he hoped to “protect” the legacy left by Gatland, who is Wales’ longest-serving head coach.
Gatland was appointed in November 2007 and in his time in charge has led Wales to two Grand Slams, a Six Nations championship and reached the semi-finals of the 2011 World Cup.
Pivac will start working for the Welsh governing body in July 2019, and take over when Gatland steps down after the World Cup, which will be played in autumn that year.
Until he takes the role, which runs until after the 2023 World Cup in France, Pivac will remain in charge of Scarlets.