Wayne Pivac celebrated his first game in charge of Wales with a 43-33 win over the Barbarians as Warren Gatland's return to Cardiff ended in defeat.
Wales scored six tries but they had to withstand a second-half fightback by the Barbarians who trailed 33-7 at one point.
Gatland was given a hero's welcome after a 12-year reign in which he led Wales from the doldrums and to top spot in the world rankings.
The New Zealander was honoured this week with the creation of "Gatland's Gate" at the main entrance to the stadium, recognition of a successful tenure which brought four Six Nations titles, three Grand Slams and two World Cup semi-final places.
The second of those last-four appearances was just 29 days before this uncapped clash, but Pivac's determination to put his stamp on Wales produced some interesting selections.
Exciting Cardiff Blues outside-half Jarrod Evans - who had missed out on World Cup selection - made only his second appearance with Wales expected to employ more width under Pivac.
Uncapped New Zealand-born Johnny McNicholl came onto the wing after qualifying through the three-year residency rule.
McNicholl's first involvement was some defensive duty, but the Scarlets speedster soon had ball in hand as both sides upheld the Barbarians' traditional values of running rugby.
Wales were ahead inside six minutes when Evans slipped a tackle and fed Josh Adams, the World Cup's try scorer adding another score to his ledger in the corner with Leigh Halfpenny adding the extras.
Evans was pulling the strings with plenty of ball coming his way but Justin Tipuric - captain in the absence of the injured Alun Wyn Jones - had a try disallowed as Aaron Wainwright was offside in the build-up.
The Barbarians made the most of their good fortune to build some pressure for Scotland's Josh Strauss to pick up and score and Curwin Bosch levelled matters with the conversion.
The friendly nature of the contest was upset by a tip-tackle on Adams and a bust-up off the ball which forced referee Nigel Owens to lay down the law.
That incident sparked Wales into life and Tomos Williams' quick tap-penalty five minutes before half-time freed Evans to send McNicholl over.
Barbarians flanker Marco Van Staden was sent to the sin-bin for killing the ball and Wales took advantage as Ken Owens profited from an overthrown line-out and Halfpenny converted for a 19-7 interval lead.
Van Staden was still off the field when Owens claimed his second try to earn a hug from his opposite number Rory Best, the former Ireland captain who was playing his final game of professional rugby.
The floodgates were open now and Adams scorched over for his second try after a Williams snipe and impressive pace from prop Wyn Jones.
But the Barbarians responded when Bosch sliced through a gap and Shaun Stevenson accepted a bouncing ball to reduce the gap further. Bosch's conversion made it 33-19.
Every attack looked like ending in a try as the game opened up, Gareth Davies' effort for Wales quickly cancelled out by his fellow replacement Craig Millar.
The Barbarians continued their remarkable comeback when flanker Peter Samu was on the end of more slick work, and Bosch's kick reduced the gap to seven points.
But a late Halfpenny penalty, taking his contribution to 13 points, ensured that the Pivac era would get off to a winning start.