Young Wales survived a major scare as they held out for victory in the first Test of their summer tour to Japan.
Harry Robinson scored a second-half try but Wales were out-scored two tries to one as Japan responded through Michael Broadhurst and Yoshikazu Fujita.
However Japan were made to pay for missing three kicks as 14 points from the boot of Dan Biggar and a Rhys Patchell penalty saw Wales hold on at Kintetsu Hanazono Stadium.
Wales had looked to set the early pace but it was Japan who took the lead in the 14th minute.
Owen Williams tackled Craig Wing but was unfortunate to inadvertently block Harumichi Tatekawa’s kick as he retreated to hand Ayumu Goroumaru his first attempt at goal, which he swept over between the posts.
The full-back doubled the lead on 20 minutes when Wales paid the price for a series of penalties and number eight Rob McCusker was sent to the sin bin.
Following discussions between the two teams, South African referee Lourens van der Merwe agreed to a water break amid 30-degree heat and 80 per cent humidity and it was Wales who benefited from the refreshment.
Biggar kicked a brace of penalties, as well as pushing a third effort wide to the right, to level the scores before the half-hour.
Wales’ forwards had success at close range and at the scrum but the lack of a natural openside flanker proved telling.
Japan twice went close to scoring after Male Sau’s break released Fujita who was denied in the right-hand corner by Liam Williams before their forwards were held up over the line from the resulting lineout.
But a well-worked move from the Japanese lineout, which had been coached during the week by former England captain Steve Borthwick, saw Broadhurst score in space.
Goroumaru missed the conversion and was then off-target again early in the second half.
Instead Biggar converted his third penalty in the 47th minute though Wales were fortunate not to fall further behind when they were again caught offside, only for Goroumaru to push an effort wide for a third time.
Wales thought they had scored their first try on 58 minutes but Dafydd Howells put his foot in touch before releasing his pass to Liam Williams.
However Biggar landed his fourth penalty moments later to give the visitors the lead for the first time in the game on the hour mark.
Wales grew in confidence and when Liam Williams linked up in midfield with new caps Emyr Phillips and Owen Williams, Robinson raced clear from 25 metres for his second try in as many international appearances.
Biggar converted to hand Wales a 19-11 lead on 64 minutes before making way for Cardiff’s Patchell to win his first cap.
Japan refused to give up and replied with a well-worked try for right wing Fujita ten minutes from time following a series of attacks and swifts handling by Yuu Tamura, Tatekawa and Sau.
Goroumaru recovered from his earlier misses to steer his conversion between the posts from out wide and reduce the Welsh lead to a single point. But Patchell’s 78th minute penalty ensured Wales held out for an unconvincing victory.