Wales took a step closer to the World Cup quarter-finals before their final match against Australia after a 23-13 win over Fiji.
Gareth Davies had Wales on the board after only six minutes with Scott Baldwin scoring their second in an open, entertaining first half that Wales dominated to lead 17-6.
However the second half was much closer, with Fiji's poor goal-kicking hindering their hopes of an upset, although Wales failed to pick up what could have been a crucial bonus point.
After the break, Vereniki Goneva finished off the try of the tournament so far, only for Dan Biggar to put Wales beyond reach with a couple of important penalties.
But despite Davies coming close to a second they had to settle for a four points, which will give both Australia and England hope ahead of their key game at Twickenham on Saturday.
Wales flew out of the blocks with an early break from George North and while he was eventually hauled down, Fiji crept offside in defence from close range.
Knowing they needed a bonus point, Wales kicked for the corner, earning a second penalty from a strong driving maul and although they weren't able to score immediately, they didn't have to wait long.
Having turned the ball over, Fiji got themselves into trouble when trying to run the ball out of their own in-goal area after a good chase from Davies. The scrum-half then took full advantage of a five-metre scrum, dummying and diving under the posts. Biggar converted and Wales were on their way, leading 7-0.
While Fiji were slow out of the blocks, they were clearly up for it, and their scrum was particularly dominant. After getting the nudge on in the first scrum, they obliterated Wales in the second, earning a penalty that Ben Volavola slotted from 45 metres out on the left.
Fiji should have got back to within a point when they earned a penalty from a lineout infringement by Taulupe Faletau, but Volavola pushed a much easier kick wide.
And they were made to pay on 20 minutes when Davies took a quick tap and broke through. He was caught but when the ball rebounded into the hands of Sunia Koto, the Fijiian forward was penalised for offside and Biggar pushed the lead back to seven with the easy penalty.
Wales almost had their second try just before the hour when Davies sniped down the blindside, however the TMO spotted a dangerous neck roll from Bradley Davies in the build-up for which the lock was fortunate to escape a card.
Back in the ascendancy, Wales got their second a few minutes later, with Biggar delaying a pass beautifully to get Alun Wyn Jones away. Tyler Morgan was then stopped fractionally short of the line and Scott Baldwin popped up to barrel over, with the TMO deeming he had just kept hold of the ball as he dotted down. Biggar's conversion made it 17-3 to the home side.
Fiji needed a spark, and they almost got it when Aseli Tikoirotuma produced a stunning break, stepping inside George North and then outside Matthew Morgan, but the move broke down when Volavola knocked. The Fijian scrum was on top though and earned another penalty, with Volavola doing the honours to cut the deficit to 11 at the break.
The Welsh scrum continued to suffer early in the second half, and after one magical break from Tikoirotuma with great support, Fiji should have cut their deficit even further but Volavola missed a simple shot at goal following an intentional knock-on.
Fiji had their try on 48 minutes, with Tikoirotuma again the instigator. He went clean through in his own 22 and and then found Timoci Nagusa in support. The winger had Goneva on his shoulder to finish off the try of the tournament so far. Volavola converted to make it 17-13.
The momentum was with the visitors, but they weren't helped out when Akapusi Qera was penalised for what looked like a textbook steal at a breakdown, referee John Lacey deciding he had gone off his feet. Biggar didn't mind, continuing his stellar tournament by nailing the long-range penalty from out wide.
The game was opening up, just as the Fijians had hoped, and they could have drawn level on the hour when they again broke through in space, this time through Leone Nakarawa. The Welsh defence just about held though, despite a couple of cracking offloads.
Fiji were playing with fire though as they struggled to get out of their own 22, and after a Volavola kick was charged down they were penalised for piling over the top despite a dominant scrum. Biggar slotted the resulting penalty to make the game safe.
Man of the Match: Aseli Tikoirotuma was unstoppable for Fiji and Gareth Davies scored one try and almost had two more but Wales' matchwinner was Dan Biggar. The best fly-half in the tournament so far nailed some crucial penalties and played a key role in Wales' second try. His late withdrawal will be a concern for Warren Gatland.
Moment of the Match: There's no question that it was the Vereniki Goneva try. Tikoirotuma started it in his own half, supported by Timoci Nagusa on his shoulder. Goneva then popped up to finish off a simply magical move.
Villain of the Match: It was generally a clean game but Bradley Davies appeared fortunate to escape with just a penalty for a dangerous neck roll in the first half. What was supposedly a focus for referees coming into the tournament has been largely considered worthy of just a penalty.
Tries: G Davies, Baldwin
Cons: Biggar 2
Pens: Biggar 3
Pens: Volavola 2
Wales: 15 Matthew Morgan, 14 Alex Cuthbert, 13 Tyler Morgan, 12 Jamie Roberts, 11 George North, 10 Dan Biggar, 9 Gareth Davies, 8 Taulupe Faletau, 7 Sam Warburton (c), 6 Dan Lydiate, 5 Alun Wyn Jones, 4 Bradley Davies, 3 Tomas Francis, 2 Scott Baldwin, 1 Gethin Jenkins.
Replacements: 16 Ken Owens, 17 Aaron Jarvis, 18 Samson Lee, 19 Luke Charteris, 20 Justin Tipuric, 21 Lloyd Williams, 22 Rhys Priestland, 23 James Hook.
Fiji: 15 Metuisela Talebula, 14 Timoci Nagusa, 13 Vereniki Goneva, 12 Lepani Botia, 11 Aseli Tikoirotuma, 10 Ben Volavola, 9 Nemia Kenatale, 8 Netani Talei, 7 Akapusi Qera (c), 6 Dominiko Waqaniburotu, 5 Leone Nakarawa, 4 Tevita Cavubati, 3 Manasa Saulo, 2 Sunia Koto, 1 Campese Maafu.
Replacements: 16 Viliame Veikoso, 17 Peni Ravia, 18 Leeroy Atalifo, 19 Nemia Soqeta, 20 Malakai Ravulo, 21 Henry Seniloli, 22 Joshua Matavesi, 23 Kini Murimurivalu.
Referee: John Lacey (Ireland)
Assistant Referees: Jérôme Garcès (France), Mathieu Raynal (France)
TMO: George Ayoub (Australia)