Two second-half tries from Megan Gaffney were in vain as Scotland’s first match at a Rugby World Cup in 12 years ended in a heart-breaking 18-15 defeat.

Wales had dominated the scoreboard throughout, leading from the sixth minute until two minutes from the end when Gaffney powered over for her second to level the scores.

It looked for all the world that the match would end in only the third draw in tournament history but after 25 phases of play with the clock in the red, Wales were awarded a penalty and replacement scrum-half, Keira Bevan, kept her nerve to kick her side to victory from 30 metres out.

With very little to choose between the teams in the World Rugby Women’s Rankings powered by Capgemini and a history of close matches between the teams, this all-Six Nations encounter had the potential to go either way.

However, Wales started much more confidently, with their greater Rugby World Cup experience allowing them to settle into their rhythm.

It was all Wales for the majority of the first half and they thoroughly deserved to open the scoring in the sixth minute when Alisha Butchers powered over from close range, Eleanor Snowsill converting.

With Megan Webb making a couple of telling breaks in midfield, Wales continued to be on the front foot and another penalty from Scotland was punished by the boot of Snowsill, who took Wales’ lead into double figures with 13 minutes gone.

Wales were looking really fluent in attack and only the impressive work of Scotland at the breakdown, led by Sarah Bonar, prevented any further scores.

Gradually Scotland found their composure and managed to get some territory and possession.

After a bad penalty miss by Helen Nelson, the sustained pressure inside the Wales 22 eventually told as Lana Skeldon scored from the back of a maul just before the half-hour mark.

But Wales finished the half the stronger of the two sides and they scored their second try from a slick first-phase strike backs move, with Hannah Jones’ deft offload creating an overlap on the right for Kayleigh Powell to finish off.

Scotland fly-half Nelson had the chance to cut the deficit when Scotland were awarded another penalty just before the break but she failed for the third time from the tee, badly scuffing her attempt from virtually in front of the posts.

The start of the second half mirrored the first and it took a try-saving tackle by Scotland scrum-half Caity Mattinson on Jasmine Joyce to prevent Wales from extending their lead.

Scotland turned to their forwards to get back into the match and after a 12-minute period inside the Wales 22 and a lengthy stoppage for an injury to Eilidh Sinclair, the tide finally started to turn.

Wales went down to 14 players when referee Clara Munarini sent loose-head Cara Hope to the sin-bin following a succession of scrum penalties and Scotland capitalised when they spread the ball wide for Megan Gaffney to score in acres of space.

Butchers’ galloping run nearly won it for Wales, but she was stopped inches short and was subsequently injured in the tackle.

Scotland’s never-say-die attitude in defence saw them stay in touching distance of Wales and a second yellow card for Wales, to Joyce for a deliberate knockdown, further helped their cause.

With all the momentum now with Scotland, Gaffney showed supreme strength in contact to score in the same corner as before but Nelson was unable to convert from out wide.

It was her fifth miss out of five and, ultimately, those missed kicks cost Scotland the match, with Bevan making them pay.