Wales kept their World Cup quarter-final hopes alive after seeing off Samoa 17-10 at Waikato Stadium in Hamilton on Sunday.
Trailing by four points (6-10) at half-time, Wales dug deep to deny the Samoans victory thanks to a try by wing Shane Williams thirteen minutes from full-time which proved to be the match-winner.
After major upsets in 1991 and 1999 against Samoa, it was Wales' first victory over their bogey team at a World Cup tournament.
The win, following their 16-17 opening loss to South Africa, puts Wales in the box seat to qualify second from Pool D with a likely quarter-final against Six Nations rivals Ireland.
However Wales were given a scare or two along the way and it looked as if Warren Gatland's reign as coach could be brought to an end in his hometown of Hamilton.
In bright and breezy conditions at a packed Waikato Stadium, James Hook's early penalty from the halfway line went narrowly wide and Samoa passed up a golden chance when Sailosi Tagicakibau spilled a low pass just metres from the tryline.
Wales suffered a blow when flanker Danny Lydiate limped off in just the 11th minute to be replaced by Andy Powell. But Hook was gifted an easy three points when Maurie Faasavalu high-tackled pivot Rhys Priestland.
Jamie Roberts crossed on 14 minutes but was brought back for a forward pass and Priestland missed his third drop-goal of the World Cup, before Samoa full-back Paul Williams levelled the scores with a well-struck penalty.
Samoa's forwards disintegrated under a powerful Welsh scrum to give Hook another penalty to make it 6-3.
Despite clearly having issues in the scrum, the Samoans had no such problems in the breakdown - with their pack happy to hammer away around the fringes of the breakdown to drive Wales back.
And they were left frustrated when an 18-phase spell ended with Fa'asavalu burrowing over from close range, only for the flanker to be pinged for a double movement.
A missed penalty from Williams soon after did little to lift the mood of the Samoans.
However, Samoa had the final say in the first half as their forwards took control and they dealt Wales an enormous hit when another crunching attack culminated in a try to prop Anthony Perenise's on the stroke of half-time. Williams' conversion gave the islanders a 10-6 half-time lead.
Hook was replaced by Leigh Halfpenny at half-time after a shoulder injury and the Welsh reduced the margin to 10-9 when Priestland's penalty fortuitously bounced off the crossbar and over.
The Wales backs were suddenly in the game and centre Jonathan Davies had the tryline at his mercy when a long cross-field kick bounced off his legs, but Priestland then kicked them 12-10 ahead after a ruck infringement.
And Wales were again rewarded for their greater endeavour when Halfpenny broke down the left and fed Davies, whose one-handed pass was gathered off the floor by Williams for his 55th Test try, 13 minutes from the end.
Samoa regrouped and continued to hammer away at the Wales line but they couldn't find a way through. Samoa's forwards massed for one final assault but the attempt was undone when number eight George Stowers lost control of the ball at the tryline.
Wales survive to fight another day.
Man of the match: Sam Warburton did some great work for Wales at key moments, and he was at the forefront of his team's effort, however it's hard to look past Welsh Wizard Shane Williams whose try allowed his team to breathe a little easier.
Pens: Hook 2, Priestland 2
Wales: 15 James Hook, 14 George North, 13 Jonathan Davies, 12 Jamie Roberts, 11 Shane Williams, 10 Rhys Priestland, 9 Mike Phillips, 8 Toby Faletau, 7 Sam Warburton (c), 6 Dan Lydiate, 5 Alun-Wyn Jones, 4 Luke Charteris, 3 Adam Jones, 2 Huw Bennett, 1 Paul James.
Replacements: 16 Lloyd Burns, 17 Gethin Jenkins, 18 Bradley Davies, 19 Andy Powell, 20 Tavis Knoyle, 21 Scott Williams, 22 Leigh Halfpenny.
Samoa: 15 Paul Williams, 14 Sailosi Tagicakibau, 13 George Pisi, 12 Seilala Mapusua, 11 Alesana Tuilagi, 10 Tusi Pisi, 9 Kahn Fotuali'i, 8 George Stowers, 7 Maurie Fa'asavalu, 6 Ofisa Treviranus, 5 Daniel Leo, 4 Kane Thompson, 3 Anthony Perenise, 2 Mahonri Schwalger (c), 1 Sakaria Taulafo.
Replacements: 16 Ti'i Paulo, 17 Census Johnston, 18 Joe Tekori, 19 Taiasina Tuifu'a, 20 Junior Poluleuligaga, 21 Eliota Fuimaono Sapolu, 22 Tasesa Lavea.
Referee: Alain Rolland (Ireland)