Warren Gatland believes Wales can build with confidence towards the World Cup despite their latest agonising defeat to a southern hemisphere giant.

Wales had been on course for a first ever win over South Africa on Springbok soil when they led 30-24 in the dying moments of the second Test in Nelspruit.

But their hopes were dashed when an illegal challenge by Scarlets full-back Liam Williams on wing Cornal Hendricks resulted in a penalty try, which Morne Steyn converted to give the home side a 31-30 victory and a 2-0 Test series success.

Having turned in disappointing performances against England and Ireland in the Six Nations, as well as in the first Test in Durban, plenty of questions had been asked of the tourists just 15 months out from next year's global showpiece.

But they answered their critics in fine style, with the likes of Gethin Jenkins, tireless skipper Alun-Wyn Jones and Taulupe Faletau producing monumental individual displays.

Gatland admits a win against one of South Africa, New Zealand and Australia is needed by his side with the knowledge their World Cup group contains two heavyweights in the Wallabies and hosts England.

But the New Zealander felt the second Test performance has highlighted his men can compete with the best in the game.

He said: "Sometimes you play against the best teams in the world and our players that come in haven't always played at the same level of intensity.

"That's why we got caught out last week, particularly in the first half.

"We were also caught out in the first Test in Australia a couple of years ago and in the first Test in New Zealand in 2010 as well.

"But the boys have got comfortable with the pace and intensity and have come out and improved their performances in the second week.

"We have such a small playing base of players. We have got an incredibly tough pool for the World Cup, but we can look forward to it with some confidence.

"We know on the day if we get the bounce of the ball and a couple of things go our way we are good enough to compete with the top teams in the world.

"We are probably a little bit off New Zealand at the moment, but we have demonstrated with South Africa and Australia in the last couple of years it's just a case of getting over the line.

"It's just making sure that you get that elusive victory over a southern hemisphere team and then mentally it just changes that whole focus."

The first Test reverse at Kings Park had led to calls for a number of changes to be made in Nelspruit, but in the end Gatland chose to make only two alterations, bringing in prop Samson Lee and flanker Josh Turnbull for Adam Jones and Aaron Shingler respectively.

Captain Alun-Wyn Jones felt the players had justified their coach's loyalty, and hopefully silenced their critics.

"I think there was 77 minutes and 15 seconds on the clock and we were still in the lead," he said.

"Ultimately we can take a bit of pride out of the week as a whole, not just the performance.

"A lot of negativity, which we try to ignore, gets bounced about with social media. With stuff like that, you are never too far away from home.

"But as a collective we can be proud and, moving forward, this is not the result we would have wanted going into the off season, but definitely the performance."