Wing Josh Adams scored a hat-trick to guide Wales to the World Cup quarter-finals with a pulsating 29-17 victory over Fiji in Oita.
Wales came from 10-0 down and overcame an early Fiji onslaught in a bruising battle in Oita.
Full-back Liam Williams also crossed late to secure a bonus point.
The victory came at a cost with injury concerns for the rest of the tournament over fly-half Dan Biggar and centre Jonathan Davies.
Cardiff Blues wing Adams limped off in the final minutes, injured in scoring his third try.
Both sides had two players yellow-carded in a frenetic encounter in which flamboyant Fiji excelled in broken play.
- Head injury rules Biggar out of Uruguay match
- We showed real character – Gatland
There were also 31 missed tackles by Wales and five disallowed tries between both sides to demonstrate the captivating contest witnessed in Japan.
It was a third victory after previous wins over Georgia and Australia. Wales now top Pool D and are in line to win the group by defeating Uruguay in four days’ time.
Wales will be without Biggar for that final pool match after he suffered a second head injury in successive games and will be a doubt for a quarter-final, probably in 11 days in Oita.
Davies will also be a doubt for the knockout stages after picking up a knee injury.
Assuming Wales clinch Pool D with victory over Uruguay, Warren Gatland’s side will play the Pool C runners up.
That will be either England or France with the two sides scheduled to meet in a group decider on Saturday.
Spare a thought for the Fijians who experienced a mixed tournament with defeats against Australia and Uruguay and an impressive 45-10 victory over Georgia.
At times, they were breathtakingly brilliant in attack and brutal in defence, while Wales demonstrated courage and class to seal the victory and cement their place in the knockout stages.
Flanker James Davies and Moriarty were the two changes in the Welsh back-row, coming in for Justin Tipuric and Aaron Wainwright.
Davies joined older brother Jonathan Davies in the same Wales starting side for a second time. They became the third pair of Welsh brothers to play in a World Cup game following Paul and Richard Moriarty in 1987 and Scott and Craig Quinnell in 1999.
But the family telepathic connection failed to work when James gave away a penalty chasing a kick from his older brother to hand a five-metre attacking scrum.
Wing Josua Tuisova scored an incredible try as he powered through Adams and held off the challenge of Biggar and Josh Navidi.
In a breathless start Wales and Fiji had tries ruled out for infringements before Wales hooker Ken Owens was yellow-carded for a dangerous tackle.
Fiji immediately made the extra man tell with full-back Kini Murimurivalu powering over although Ben Volavola missed another conversion.
Fiji were reduced to 14 men when lock Tevita Cavubati was guilty of a reckless shoulder into the back of Moriarty at a ruck.
This incident prompted a rapid response by Wales as Adams leapt to catch a pinpoint Biggar cross kick with the Wales fly-half converting.
Adams was denied a try with a foot in touch before Fiji flanker Semi Kunatani was yellow carded for offside.
After a series of scrums on the line and some patient build-up, Adams crossed for his second with Biggar again converting from the touchline.
Fiji retaliated and were denied another try when Mata crossed because of a forward pass.
Two tries disallowed for each side by the TMO and three men yellow-carded. Quite the frantic first 40 minutes.
Wales’ defence had briefly tightened up in the second quarter but Fiji tested the rearguard resilience again at the start of the second-half with Radradra outstanding.
Fiji had a third try disallowed for a forward try before James Davies became the second Welsh player to be yellow carded by Jerome Garces for a ruck offence.
Fiji took advantage with a penalty try and regained the lead after Wales collapsed a maul.
Wales then saw Liam Williams collide into Dan Biggar with the fly-half sickeningly collapsing onto the turf and Garces stopped the game immediately,
Biggar eventually ran off the field to be replaced by Rhys Patchell after suffering a second head injury in successive games.
Patchell’s first major contribution was to slot over a penalty as Wales recovered from a ragged period.
Centre Davies provided a brilliant intervention with a searing break and fend before an outstanding offload provided Adams with his third try.
The try had consequences with Davies forced off the field and Adams struggling with a leg injury before being replaced after hobbling for a short period.
Scrum-half Gareth Davies turned provider when he set up Williams for Wales’ fourth crucial try to clinch victory.
But this victory might come at a cost and it was telling that none of the players celebrated at the final whistle.
Player of the match
Wales coach Warren Gatland: “It was tough. From 10-0 down I would’ve taken a bonus-point win. We showed some real character to get back into that.
“They have some incredible individual athletes, we showed some character to fight back, I’m pleased with that performance and result. It was a little bit different to the first two games, hopefully it’ll set us up nicely going forward.”
Wales: L Williams; North, Jonathan Davies, Parkes, Adams; Biggar, G Davies; Wyn Jones, Owens, Francis, Ball, Alun Wyn Jones (C), Navidi, James Davies, Moriarty.
Replacements: Carre, Dee, Lewis, Shingler, Wainwright, T Williams, Patchell, Watkin.
Fiji: Murimurivalu; Tuisova, Nayacalevu, Botia, Radradra; Volavola, Lomani; Ma’afu, S Matavesi, Saulo, Cavubati, Nakarawa, Waqaniburotu (C), Kunatani, Mata.
Replacements: Dolokoto, Mawi, Ravai, Ratuniyarawa, Yato, Matawalu, Vatubua, J Matavesi.
Officials: Referee: Jerome Garces (France); Assistant referees: Romain Poite (France), Karl Dickson (England); TMO Ben Skeen (New Zealand).