Samoa made a strong start, taking a 10-0 lead after as many minutes with a try to winger Alapati Leiua and a conversion and penalty to flyhalf Tusi Pisi. Wales fought its way back into the match with three first-half penalties to flyhalf Sam Davies and took the lead for the first time with Evans' first try in the second minute of the second half.
Samoa regained the lead 10 minutes later with a try to hooker Manu Leiataua, converted by Pisi, and led 17-14 approaching fulltime. But Wales snatched back the lead with a second try to Evans in the 73rd minute and defended superbly to hold out Samoa when they threatened in the final minutes.
Wales was severely depleted by the loss of more than 15 players to the British and Irish Lions and had 12 uncapped players in its squad for its Pacific tour. It still posted wins over Tonga in Auckland last week and over Samoa in difficult conditions.
"It's one of the toughest games I've played in because the conditions were pretty atrocious and both teams were limited to playing a bit of a kicking game," Wales captain Jamie Roberts said. "I'm so proud of the lads.
"It was a bit of an arm wrestle but to come through in those final minutes showed a lot of grit. There's a lot of new players and that's what it's about. We knew it would come down to how much the lads wanted it and I thought they showed great steel."
Samoa held the early advantage in the match when it rocked Wales with Leiua's try. Pisi put in a crosskick which challenged the Wales defense and when Samoa reclaimed possession it moved the ball quickly wide for the winger to score.
Wales rallied strongly, cutting into Samoa's advantage through the remainder of the first half and seizing the lead with Evans' try shortly after halftime. It charged down a clearing kick from Pisi, reclaimed possession and hooker Ryan Elias and prop Dillon Lewis handled before Evans scored in the corner.
Scrumhalf Kahn Fotuali'i created Leiataua's try in the 52nd minute, making the break through a mass of forwards after a lineout. After prop Viliami Afatia carried the ball on, Samoa quickly recycled possession and Fotuali'i picked out Leiataua, who scored.
Evans scored the winner seven minutes from fulltime after Wales showed skill to maintain the wet ball through 12 phases. On the last phase they pierced the gain line and four quick passes put Evans in an overlap near the left-hand touch.
Wales twice turned over Samoa possessions in the last five minutes to hold their slender advantage and scrumhalf Aled Davies kept Samoa under pressure with high kicks. "It could have gone either way but I'm proud of the effort the boys put in today so we go into the Pacific Nations Cup in two weeks with high hopes," Samoa captain David Lemi said.
Wales 19 (Steffan Evans 2 tries; Sam Davies 3 penalties), Samoa 17 (Alapati Leiua, Manu Leiataua tries; Tusi Pisi 2 conversions, penalty), HT: 9-10.