CNN  — 

Josh Adams scored a hat-trick to help Wales recover from an early 10-point deficit to beat Fiji 29-17 and qualify for the quarterfinals of the Rugby World Cup.

The Pacific Islanders made the perfect start as Josua Tuisova produced a brilliant solo finish to score a fourth-minute try.

Fiji then took advantage of a yellow card for Wales hooker Ken Owens shortly after and Kini Murimurivalu added a second.

After its early scare, and with Fijian lock Tevita Cavubati in the sin bin, Wales got on the board through Adams after he gathered an expertly judged cross kick from Dan Biggar on 17 minutes.

In an eventful first half, Fiji was shown another yellow card – the third in 28 minutes – as Semi Kunatani was penalized for repeated infringements and numerous warnings.

Once again, Wales wasted no time making Fiji pay as Adams scored his second try to put his side in front.

Fiji started the second half quickly, and its pressure eventually paid off as flanker James Davies was shown the games’ fourth yellow card and Fiji took advantage immediately with a penalty try.

An ugly collision between two Welsh players caused Biggar to leave for a head injury assessment before Adams completed his hat-trick with another expertly taken try.

Wales finished strongly, and Williams wrapped up the bonus-point victory with his side’s fourth try.

The win ensures that if Wales beats unfancied Uruguay Sunday in its final group game, it will finish top of Pool D.

Despite the result going against his team, coach John McKee was pleased with the Fijians’ gutsy performance.

“I’m just so proud of the effort our boys put in this evening,” the Kiwi-born coach said. “They’re playing the Six Nations champions, a team that’s been no. 1 in the world this year and we really took the game to them.

“And although we didn’t get there in the end, I think it was an absolute gallant effort all round. The players have been so committed, a lot of them are playing around the world but they still come back to play for Fiji.

“They’re so proud to wear the white jersey and represent their people and you see the passion with which they play in games like this.”

Fiji's players gather after its defeat to Wales.

READ: Josh Larsen got red carded – then went into the Springboks locker room and apologized

A victory, but at what cost?

Wales’ win over Fiji was a physical slog, with hard hits and big collisions a constant occurrence.

And due to the physical nature of the game the injuries started to pile up.

Biggar suffered a head injury after colliding with his teammate Williams and both Adams and Jonathan Davies appeared to suffer leg injuries in the buildup to Wales’ third try.

“Josh Adams did really well,” said Wales coach Warren Gatland. “We’ve got a tough four-day turnaround to Uruguay so I think the medics are going to be working pretty hard over the next 24-48 hours.”

“We just had to stay in the game. At 10-0 down, I think I would’ve taken that score line, a bonus point win.

“That was tough though, they’ve got some unbelievable individuals and we just had to stay in it and the message was ‘keep trying to play through phases’ because when we get the ball and play through phases, we created opportunities. But we didn’t do that enough. It was a tough, physical, great game of rugby.”

Dan Biggar is attended to by medics after a collision with Liam Williams.

READ: Rugby World Cup keeps nervous eye on Typhoon Hagibis trajectory

Bowing out with heads held high

In terms of results, it’s been a disappointing World Cup campaign for Fiji, which has lost three out of its four group games.

However, having finished third in Pool D, the Pacific Islanders have guaranteed their place at the World Cup in France in four years’ time.

“It’s never easy being with a team coming from a small nation,” said Fiji captain Dominiko Waqaniburotu. “Leaving your families behind, leaving everything behind and coming to this kind of big campaign.

Visit for more news, features, and videos

“It’s a lot of pressure being put on the boys and I’m just so thankful. They’re just keeping their heads up even though it’s not a win today, it’s not the result we wanted.

“I’m still giving thanks for what the boys did today.”