Wales' 2015 World Cup warm-up games against Ireland and Italy will be broadcast on BBC Wales television, radio and online.
Wales face Ireland home and away on 8 and 29 August, before head coach Warren Gatland trims his squad to 31 for the World Cup.
Then they host Italy in their last tournament warm-up on 5 September.
BBC Wales will show both home matches live on television and highlights of the 29 August clash in Dublin.
Welsh-language channel S4C will show highlights of the 8 August match and broadcast the Italy game in full from Millennium Stadium.
WRU chairman Gareth Davies welcomed the deal.
"We are looking at a sell-out at the Millennium Stadium for that first Dove Men Test clash with Ireland and so it has been all the more important to reach an agreement on the broadcast rights which will ensure that the nation can follow Warren Gatland's side every step of the way as they prepare for the Rugby World Cup," he said.
"By the time we face Italy in September our final squad for the Rugby World Cup will have been named and excitement will be building to a frenzy."
BBC Wales head of sport Geoff Williams said: "Rugby internationals always excite the nation, so we're primed and ready to follow Wales all the way to the Rugby World Cup by providing comprehensive coverage of these fascinating games.
"With places in the World Cup starting line-up at stake, there should be plenty of talking points for our viewers and listeners."
S4C director of content Dafydd Rhys said: "We are delighted to be providing free-to-air live coverage of the Italy match and highlights of the Ireland match in Welsh on S4C.
"These matches are the ideal build-up for Welsh rugby fans to the Rugby World Cup this autumn which S4C will broadcast along with a package of nine live games and a comprehensive highlights package."