Neath wing Shane Williams showed all his finishing skills to claim two tries against a Japan Select XV at the Nagai Stadium in Osaka and get Wales' tour back on track.
But the win came at a cost, with an ankle injury to centre Allan Bateman ending his involvement in the tour.
Having lost their opening match to Suntory 45-41, Wales were wobbling once again in their second match when they found themselves trailing by two points at half-time.
Yet the tourists appeared transformed after the interval, taking the game to their hosts with forwards punching holes in the Japan Select defence and carving out chances for the backline.
Williams made the most of his opportunities, although his opposing winger Yamauchi also claimed a brace of tries, while Neath team-mate Lee Jarvis kicked 18 points at fly-half.
The Japan Select had stunned Wales by taking an early lead when second row Akune squirted over from a close-range ruck for a try, converted by fly-half Tanaka.
Wales hit back when Bridgend centre Adrian Durston foxed the Japanese midfield with a superb dummy to waltz over for a try, with Jarvis converting to bring the scores level.
Fly-half Jarvis added two penalties to put Wales into the lead for the first time, only for the Japan Select to cross for a second try on the stroke of half-time.
Wales were struggling to contain the quick ruck ball being generated by the home side and the tourists were undone once again when elusive wing Yamauchi scored from five metres out.
Bateman injured his ankle early in the first half and didn't return after the interval, but Wales shrugged off the veteran centre's loss to produce a storming fightback.
With Cardiff's Jamie Robinson having been injured in the match against Suntory, however, Wales' options at centre for Sunday's first Test are now limited.
Burst through
Williams started the second-half recovery when the wing made full use of a blindside overlap to score, after the forwards had shunted their way almost to the Japan Select line.
Jarvis continued his accurate contribution by adding the extra two points and then slotting his third penalty to give Wales a 23-15 lead six minutes into the second half.
Wales were starting to impose their game plan. Five minutes later skipper Andy Moore and fellow lock Craig Quinnell punched a huge hole in the Japan Select midfield.
Quick hands saw the ball spun wide to find Williams again with an overlap on the left. There was no stopping the Neath flyer from 14 metres out, with Jarvis again turning five points into seven.
Yet the fly-half had to be on his toes defensively to haul back Tanaka soon afterwards as the Japan Select fly-half almost burst through to the try line.
The Wales defence held firm and with 13 minutes remaining the tourists had a comfortable 30-15 lead.
Jarvis added another penalty that kept Wales' noses in front when Yamauchi claimed his second try for the Japan Select, converted by fullback Tachikawa.
Wales coach Lyn Howells will be relieved that his side are now off the mark, but with the first Test looming will be concerned at how difficult the elusive Japanese backs have been to stop so far on tour.
Japan Select XV: Tachikawa; Yamauchi, Parkinson, Strongman, Oda; Tanaka, Tsuji; Takayanagi, Amino, Hamabe, Parker, Akune, Washiya, Miyashita, Scown.
Replacements: Iwama, Tsukagoshi, Nakano, Yamamoto, Ito, Mori,
Kawal.
Wales: Kevin Morgan (Swansea); Mark Jones (Llanelli); Allan Bateman (Northampton), Adrian Durston (Bridgend), Shane Williams (Neath); Lee Jarvis (Neath), Ryan Powell (Cardiff); Iestyn Thomas (Ebbw Vale), Steve Jones (Neath), Chris Anthony (Newport); Craig Quinnell (Cardiff), Andy Moore (Swansea, capt); Nathan Budgett (Bridgend), Alix Popham (Newport), Jamie Ringer (Bridgend).
Replacements: Saul Nelson (Bristol), Phil Booth (Llanelli), Michael Owen (Pontypridd), Dwayne Peel (Llanelli), Gavin Henson (Swansea), Tom Shanklin (Saracens).