Wales 17 Samoa 13:Wales survived a punishing physical examination by Samoa at the Millennium Stadium - but were made to sweat profusely for victory.
Wing Leigh Halfpenny's early try, Wales' first in Cardiff since February, threatened a runaway home win.
It did not materialise though, as Wales needed three Dan Biggar penalties and a long-range Halfpenny strike to keep the determined South Sea Islanders at bay.
Samoa, four places below Wales in the International Rugby Board world rankings, had previously beaten their hosts three times from six attempts, including twice in the Welsh capital.
London Irish centre Seilala Mapusua's second-half interception try, plus two penalties and a conversion from fly-half Fa'atonu Fili, threatened another colossal upset.
It should have been even closer but centre Gavin Williams missed a late penalty chance from in front of the posts and then Samoa wasted a prime attacking opportunity, allowing Wales to breathe a huge sigh of relief.