Wales hung on for a tense win against a fired-up Japan in the heat of Osaka.
A second-half try by Harry Robinson, converted by Dan Biggar, gave Wales the edge. Biggar kicked four penalties and replacement Rhys Patchell also kicked a penalty on his debut.
Japan scored tries through Michael Broadhurst and Yoshikazu Fujita, with full-back Ayumu Goromaru converting one and kicking two penalties.
The teams face each other again in Tokyo on Saturday, 15 June.
It was a tough test for an inexperienced Wales side in temperatures in excess of 30 degrees centigrade.
With 15 senior players on duty with the British and Irish Lions in Australia, and a number of experienced names left out of the touring party, Japan scented a chance to record their first win over Wales.
And for a while it looked possible as the visitors struggled at the breakdown and made little impact on a stubborn Japan defence.
Robin McBryde's team missed the presence of a genuine open-side flanker.
With Sam Warburton and Justin Tipuric on Lions duty in Australia, and Cardiff Blues number seven Josh Navidi not in the match day squad, Osprey James King was forced into open-side duty.
He, and the Welsh back row collectively, were second best in a poor first half display against an energetic and determined Japan side.
Full-back Ayumu Goromaru was on target twice to put Japan 6-0 up.
Wales number eight Rob McCusker was sent to the sin-bin after conceding the second of those penalties, but Wales enjoyed their best period with Biggar on target twice with penalties.
But Japan re-asserted their dominance before the interval, with Wales repelling a series of attacks before flanker Michael Broadhurst burst over unopposed from a well-worked lineout move to give Japan an 11-6 interval lead.
Japan still looked the better side after the interval, but Goromaru missed two penalty attempts while Biggar was on target for Wales to first cut the lead to two points and then to edge Wales into the lead on the hour.
Wales finally clicked behind the scrum three minutes later when full-back Laim Williams' superb pass gave Harry Robinson the room to run in for a try which Biggar converted.
It was the Ospreys fly-half's last contribution as he made way for Rhys Patchell.
But any thoughts Wales had of running away with the game were wiped out as Japan hit back.
A series of drives up the middle eventually created space on the right for wing Yoshikazu Fujita to cross on the right, with Goromaru converting.
However, Rhys Patchell, making his debut as a replacement for Dan Biggar at fly-half, calmed Welsh nerves with a penalty in the dying minutes to secure the win.
Wales: Liam Williams (Scarlets); Harry Robinson (Blues), Owen Williams (Blues), Jonathan Spratt (Ospreys), Dafydd Howells (Ospreys); Dan Bigger (Ospreys), Lloyd Williams (Blues); Ryan Bevington (Ospreys), Emyr Phillips (Scarlets), Scott Andrews (Blues), Bradley Davies (capt, Blues), Lou Reed (Blues), Andrew Coombs (Dragons), James King (Ospreys), Rob McCusker (Scarlets).
Replacements: Scott Baldwin (Ospreys), Rhys Gill (Saracens), Rhodri Jones (Scarlets), Andries Pretorius (Blues), Dan Baker (Ospreys), Tavis Knoyle (Scarlets), Rhys Patchell (Blues), Tom Prydie (Dragons)
Japan: Ayumu Goromaru, Yoshikazu Fujita, Male Sau, Craig Wing, Kenki Fukuoka, Harumichi Tatekawa, Fumiaki Tanaka; Masataka Mikami, Shota Horie, Hiroshi Yamashita, Hitoshi Ono, Shoji Ito, Hendrik Tui, Michael Broadhurst, Takashi Kikutani (capt).
Replacements: Takeshi Itu, Yusuke Nagae, Kensuke Hatakeyama, Toshizumi Kitagawa, Ryuta Yasui, Atsushi Hiwasa, Yu Tamura, Hirotoki Onozawa.