First-five Sam Davies kicked four penalties as Wales beat Tonga 24-6 at Eden Park in Auckland.
Winger Alex Cuthbert scored a first-half try and Wales were awarded a penalty try in the final minute after Tonga collapsed an attacking lineout drive.
Scrumhalf Tane Takulua kicked two penalties for the Pacific Islanders, who were cheered on by a small but boisterous contingent of supporters.
The match had been moved from Nuku'alofa because of concerns about the state of the pitch and played as the first part of a Pasifika doubleheader, with the All Blacks meeting Samoa immediately afterwards.
Tonga have never beaten the Welsh in six previous tests but said prior to the game that with 12 Wales players on duty with the British and Irish Lions they had a good chance to get their first victory.
However, Wales were in control from the outset and winger Cuthbert was twice denied tries following television reviews, once when he was forced into touch by prop Latu Talakai and the second time when he knocked the ball on.
The 27-year-old appeared to have badly injured his shoulder on the second occasion but recovered to score at his third opportunity when he gathered his own kick after being put into space by Gareth Anscombe.
Flyhalf Davies added a penalty, but had two other attempts hit the post while Tonga scrumhalf Takulua kept the scoreline close with a 23rd minute penalty.
The Newcastle Falcons scrumhalf added his second just after the break before Davies re-established the five-point lead as light rain began to fall, which affected ball handling on both sides.
Davies closed out the game with two penalties in the final 12 minutes before the Wales forwards rumbled over. Referee Nick Brian could not see the grounding but awarded a penalty try for the Tonga collapse.